import type { ColumnType, Insertable, Selectable, Updateable } from "kysely"
import type { Capabilities } from "./Capabilities"
import type { MemberRole } from "./MemberRole"
import type { MembershipType } from "./MembershipType"

import { z } from "zod"

import { capabilitiesSchema } from "./Capabilities"
import { memberRoleSchema } from "./MemberRole"
import { membershipTypeSchema } from "./MembershipType"

// @generated
// This file is automatically generated by Kanel. Do not modify manually.

/** Identifier type for public.membership_capabilities */
export type MembershipCapabilitiesRole = MemberRole

/** Identifier type for public.membership_capabilities */
export type MembershipCapabilitiesType = MembershipType

/** Identifier type for public.membership_capabilities */
export type MembershipCapabilitiesCapability = Capabilities

/** Represents the table public.membership_capabilities */
export interface MembershipCapabilitiesTable {
	role: ColumnType<
		MembershipCapabilitiesRole,
		MembershipCapabilitiesRole,
		MembershipCapabilitiesRole
	>

	type: ColumnType<
		MembershipCapabilitiesType,
		MembershipCapabilitiesType,
		MembershipCapabilitiesType
	>

	capability: ColumnType<
		MembershipCapabilitiesCapability,
		MembershipCapabilitiesCapability,
		MembershipCapabilitiesCapability
	>
}

export type MembershipCapabilities = Selectable<MembershipCapabilitiesTable>

export type NewMembershipCapabilities = Insertable<MembershipCapabilitiesTable>

export type MembershipCapabilitiesUpdate = Updateable<MembershipCapabilitiesTable>

export const membershipCapabilitiesRoleSchema =
	memberRoleSchema as unknown as z.Schema<MembershipCapabilitiesRole>

export const membershipCapabilitiesTypeSchema =
	membershipTypeSchema as unknown as z.Schema<MembershipCapabilitiesType>

export const membershipCapabilitiesCapabilitySchema =
	capabilitiesSchema as unknown as z.Schema<MembershipCapabilitiesCapability>

export const membershipCapabilitiesSchema = z.object({
	role: membershipCapabilitiesRoleSchema,
	type: membershipCapabilitiesTypeSchema,
	capability: membershipCapabilitiesCapabilitySchema,
})

export const membershipCapabilitiesInitializerSchema = z.object({
	role: membershipCapabilitiesRoleSchema,
	type: membershipCapabilitiesTypeSchema,
	capability: membershipCapabilitiesCapabilitySchema,
})

export const membershipCapabilitiesMutatorSchema = z.object({
	role: membershipCapabilitiesRoleSchema.optional(),
	type: membershipCapabilitiesTypeSchema.optional(),
	capability: membershipCapabilitiesCapabilitySchema.optional(),
})
