/**
 * 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 ZodPlaylist = ZodGenericDataSoftDelete.extend({
	name: zod.string().max(256).optional(),
	description: zod.string().optional(),
	/**
	 * List of Id of the specific covers
	 */
	covers: zod.array(ZodObjectId).optional(),
	tracks: zod.array(ZodObjectId),

});

export type Playlist = zod.infer<typeof ZodPlaylist>;

export function isPlaylist(data: any): data is Playlist {
	try {
		ZodPlaylist.parse(data);
		return true;
	} catch (e: any) {
		console.log(`Fail to parse data type='ZodPlaylist' error=${e}`);
		return false;
	}
}
export const ZodPlaylistWrite = ZodGenericDataSoftDeleteWrite.extend({
	name: zod.string().max(256).nullable().optional(),
	description: zod.string().nullable().optional(),
	/**
	 * List of Id of the specific covers
	 */
	covers: zod.array(ZodObjectId).nullable().optional(),
	tracks: zod.array(ZodObjectId).optional(),

});

export type PlaylistWrite = zod.infer<typeof ZodPlaylistWrite>;

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