import { z } from "zod/v4";
import type { AnnunciId } from "~/schemas/public/Annunci";
import type { BanlistId } from "~/schemas/public/Banlist";
import BanType from "~/schemas/public/BanType";
import type { ChatsChatid } from "~/schemas/public/Chats";
import type { EtichetteIdEtichetta } from "~/schemas/public/Etichette";
import type { EventQueueEventId } from "~/schemas/public/EventQueue";
import type { FlagsId } from "~/schemas/public/Flags";
import type { MessagesMessageid } from "~/schemas/public/Messages";
import type { OrdiniOrdineId } from "~/schemas/public/Ordini";
import type { PrezziarioIdprezziario } from "~/schemas/public/Prezziario";
import type { RinnoviId } from "~/schemas/public/Rinnovi";
import type { ServizioServizioId } from "~/schemas/public/Servizio";
import type { TestiEStringheStingaId } from "~/schemas/public/TestiEStringhe";
import type { UsersId } from "~/schemas/public/Users";

export const zUserId = z.custom<UsersId>(
	(val) => typeof val === "string",
	"falied to validate UserId",
);

export const zAnnuncioId = z.custom<AnnunciId>(
	(val) => typeof val === "number",
	"falied to validate AnnuncioId",
);

export const zChatId = z.custom<ChatsChatid>(
	(val) => typeof val === "string",
	"falied to validate ChatId",
);

export const zMessageId = z.custom<MessagesMessageid>(
	(val) => typeof val === "string",
	"falied to validate MessageId",
);

export const zPrezziarioId = z.custom<PrezziarioIdprezziario>(
	(val) => typeof val === "string",
	"falied to validate PrezziarioId",
);

export const zFlagsId = z.custom<FlagsId>(
	(val) => typeof val === "string",
	"falied to validate FlagsId",
);

export const zEtichettaId = z.custom<EtichetteIdEtichetta>(
	(val) => typeof val === "number",
	"falied to validate EtichettaId",
);

export const zOrdineId = z.custom<OrdiniOrdineId>(
	(val) => typeof val === "string",
	"falied to validate OrdineId",
);

export const zTestiEStringheStingaId = z.custom<TestiEStringheStingaId>(
	(val) => typeof val === "string",
	"falied to validate TestiEStringheStingaId",
);

// export const zEventDataTypes = z.custom<EventDataTypes>(
// 	(val) => typeof val === "object",
// 	"falied to validate EventDataTypes",
// );

export const zBanlistId = z.custom<BanlistId>(
	(val) => typeof val === "number",
	"falied to validate BanlistId",
);

export const zBanType = z.enum(BanType, {
	error: "failed to validate BanType",
});

export const zServizioId = z.custom<ServizioServizioId>(
	(val) => typeof val === "string",
	"falied to validate ServizioId",
);

// export const zComuneId = z.custom<ComuniId>(
// 	(val) => typeof val === "number",
// 	"falied to validate ComuneId",
// );

// export const zNazioneId = z.custom<NazioniId>(
// 	(val) => typeof val === "number",
// 	"falied to validate NazioneId",
// );

export const zRinnovoId = z.custom<RinnoviId>(
	(val) => typeof val === "string",
	"falied to validate RinnovoId",
);

export const zEventId = z.custom<EventQueueEventId>(
	(val) => typeof val === "number",
	"falied to validate EventId",
);
