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

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

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

});

export type Series = zod.infer<typeof ZodSeries>;

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

});

export type SeriesWrite = zod.infer<typeof ZodSeriesWrite>;

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