/**
 * Interface of the server (auto-generated code)
 */
import { z as zod } from "zod";

import {ZodObjectId} from "./object-id";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";

export const ZodType = ZodGenericDataSoftDelete.extend({
	/**
	 * Name of the media (this represent the title)
	 */
	name: zod.string(),
	/**
	 * Description of the media
	 */
	description: zod.string().optional(),
	/**
	 * List of Id of the specific covers
	 */
	covers: zod.array(ZodObjectId).optional(),

});

export type Type = zod.infer<typeof ZodType>;

export function isType(data: any): data is Type {
	try {
		ZodType.parse(data);
		return true;
	} catch (e: any) {
		console.log(`Fail to parse data type='ZodType' error=${e}`);
		return false;
	}
}
export const ZodTypeWrite = ZodGenericDataSoftDeleteWrite.extend({
	/**
	 * Name of the media (this represent the title)
	 */
	name: zod.string().optional(),
	/**
	 * Description of the media
	 */
	description: zod.string().nullable().optional(),
	/**
	 * List of Id of the specific covers
	 */
	covers: zod.array(ZodObjectId).nullable().optional(),

});

export type TypeWrite = zod.infer<typeof ZodTypeWrite>;

export function isTypeWrite(data: any): data is TypeWrite {
	try {
		ZodTypeWrite.parse(data);
		return true;
	} catch (e: any) {
		console.log(`Fail to parse data type='ZodTypeWrite' error=${e}`);
		return false;
	}
}
