import { z } from "zod";

export const LibraryTitlesInput = z.object({
	libraryId: z.number(),
	page: z.number().min(1).default(1),
	limit: z.number().min(1).max(100).default(20),
});

export const LibraryTitlesOutput = z.object({
	titles: z.array(
		z.object({
			id: z.string(),
			title: z.string(),
			year: z.number().nullable(),
			poster: z.string().nullable(),
			type: z.string(),
		}),
	),
	pagination: z.object({
		total: z.number(),
		page: z.number(),
		limit: z.number(),
		totalPages: z.number(),
	}),
});

export type LibraryTitlesInput = z.infer<typeof LibraryTitlesInput>;
export type LibraryTitlesOutput = z.infer<typeof LibraryTitlesOutput>;

export const LibraryAllInput = z.void();

export const LibraryAllOutput = z.array(
	z.object({
		id: z.number(),
		name: z.string(),
		type: z.enum(["MOVIE", "SERIES"]),
		path: z.string(),
	}),
);

export type LibraryAllInput = z.infer<typeof LibraryAllInput>;
export type LibraryAllOutput = z.infer<typeof LibraryAllOutput>;
