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

import {ZodLong} from "./long";
import {ZodFloat} from "./float";
import {ZodInteger} from "./integer";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";

export const ZodUserMediaAdvancement = ZodGenericDataSoftDelete.extend({
	/**
	 * Foreign Key Id of the user
	 */
	userId: ZodLong.optional(),
	/**
	 * Id of the media
	 */
	mediaId: ZodLong,
	/**
	 * Percent of advancement in the media
	 */
	percent: ZodFloat,
	/**
	 * Number of second of advancement in the media
	 */
	time: ZodInteger,
	/**
	 * Number of time this media has been read
	 */
	count: ZodInteger,

});

export type UserMediaAdvancement = zod.infer<typeof ZodUserMediaAdvancement>;

export function isUserMediaAdvancement(data: any): data is UserMediaAdvancement {
	try {
		ZodUserMediaAdvancement.parse(data);
		return true;
	} catch (e: any) {
		console.log(`Fail to parse data type='ZodUserMediaAdvancement' error=${e}`);
		return false;
	}
}
export const ZodUserMediaAdvancementWrite = ZodGenericDataSoftDeleteWrite.extend({
	/**
	 * Foreign Key Id of the user
	 */
	userId: ZodLong.nullable().optional(),
	/**
	 * Id of the media
	 */
	mediaId: ZodLong.optional(),
	/**
	 * Percent of advancement in the media
	 */
	percent: ZodFloat.optional(),
	/**
	 * Number of second of advancement in the media
	 */
	time: ZodInteger.optional(),
	/**
	 * Number of time this media has been read
	 */
	count: ZodInteger.optional(),

});

export type UserMediaAdvancementWrite = zod.infer<typeof ZodUserMediaAdvancementWrite>;

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