import { z } from "zod";

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

export const GetLibraryTitlesOutput = 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 GetLibraryTitlesInput = z.infer<typeof GetLibraryTitlesInput>;
export type GetLibraryTitlesOutput = z.infer<typeof GetLibraryTitlesOutput>;

export const GetAllLibrariesInput = z.void();

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

export type GetAllLibrariesInput = z.infer<typeof GetAllLibrariesInput>;
export type GetAllLibrariesOutput = z.infer<typeof GetAllLibrariesOutput>;
