import type { ColumnType, Insertable, Selectable, Updateable } from "kysely"
import type { CommunitiesId } from "./Communities"

import { z } from "zod"

import { communitiesIdSchema } from "./Communities"

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

/** Identifier type for public.pub_types */
export type PubTypesId = string & { __brand: "PubTypesId" }

/** Represents the table public.pub_types */
export interface PubTypesTable {
	id: ColumnType<PubTypesId, PubTypesId | undefined, PubTypesId>

	createdAt: ColumnType<Date, Date | string | undefined, Date | string>

	updatedAt: ColumnType<Date, Date | string | undefined, Date | string>

	communityId: ColumnType<CommunitiesId, CommunitiesId, CommunitiesId>

	name: ColumnType<string, string, string>

	description: ColumnType<string | null, string | null, string | null>
}

export type PubTypes = Selectable<PubTypesTable>

export type NewPubTypes = Insertable<PubTypesTable>

export type PubTypesUpdate = Updateable<PubTypesTable>

export const pubTypesIdSchema = z.string().uuid() as unknown as z.Schema<PubTypesId>

export const pubTypesSchema = z.object({
	id: pubTypesIdSchema,
	createdAt: z.date(),
	updatedAt: z.date(),
	communityId: communitiesIdSchema,
	name: z.string(),
	description: z.string().nullable(),
})

export const pubTypesInitializerSchema = z.object({
	id: pubTypesIdSchema.optional(),
	createdAt: z.date().optional(),
	updatedAt: z.date().optional(),
	communityId: communitiesIdSchema,
	name: z.string(),
	description: z.string().optional().nullable(),
})

export const pubTypesMutatorSchema = z.object({
	id: pubTypesIdSchema.optional(),
	createdAt: z.date().optional(),
	updatedAt: z.date().optional(),
	communityId: communitiesIdSchema.optional(),
	name: z.string().optional(),
	description: z.string().optional().nullable(),
})
