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

import type { ColumnType, Insertable, Selectable, Updateable } from "kysely"

import { z } from "zod"

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

/** Represents the table public.PubFieldSchema */
export interface PubFieldSchemaTable {
	id: ColumnType<PubFieldSchemaId, PubFieldSchemaId | undefined, PubFieldSchemaId>

	namespace: ColumnType<string, string, string>

	name: ColumnType<string, string, string>

	/** (JSONSchemaType<any>, 'ajv', true, false, true) */
	schema: ColumnType<unknown, unknown, unknown>

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

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

export type PubFieldSchema = Selectable<PubFieldSchemaTable>

export type NewPubFieldSchema = Insertable<PubFieldSchemaTable>

export type PubFieldSchemaUpdate = Updateable<PubFieldSchemaTable>

export const pubFieldSchemaIdSchema = z.string().uuid() as unknown as z.Schema<PubFieldSchemaId>

export const pubFieldSchemaSchema = z.object({
	id: pubFieldSchemaIdSchema,
	namespace: z.string(),
	name: z.string(),
	schema: z.unknown(),
	createdAt: z.date(),
	updatedAt: z.date(),
})

export const pubFieldSchemaInitializerSchema = z.object({
	id: pubFieldSchemaIdSchema.optional(),
	namespace: z.string(),
	name: z.string(),
	schema: z.unknown(),
	createdAt: z.date().optional(),
	updatedAt: z.date().optional(),
})

export const pubFieldSchemaMutatorSchema = z.object({
	id: pubFieldSchemaIdSchema.optional(),
	namespace: z.string().optional(),
	name: z.string().optional(),
	schema: z.unknown().optional(),
	createdAt: z.date().optional(),
	updatedAt: z.date().optional(),
})
