import { z } from "zod";
import { MetadataLanguage } from "../language";
import { ProviderId } from "./providers";

export const MovieInfo = z.object({
	/** File Name */
	fileName: z.string(),
	/** Duration playback in seconds */
	runtimeSeconds: z.number(),
	/** Title Name*/
	title: z.string(),
	/** Title Year */
	year: z.number(),
	/** Original language from file */
	language: z.string(),
	/** Metadata Language */
	metadataLanguage: MetadataLanguage,
});
export type MovieInfo = z.infer<typeof MovieInfo>;

export const ResolvedMovieMetadata = z.object({
	title: z.string(),
	year: z.number(),
	description: z.string(),
	originalTitle: z.string(),
	tagline: z.string().optional(),
	releaseDate: z.string(),
	genres: z.string().array(),
	posterUrl: z.string().nullable(),
	backdropUrl: z.string().nullable(),
	rating: z.number(),
	popularity: z.number().optional(),
	language: z.string(),
	originalLanguage: z.string().optional(),
	countries: z.string().array(),
	homepage: z.string().optional(),
	providerIds: ProviderId.array().optional(), // Array of external provider IDs
});
export type ResolvedMovieMetadata = z.infer<typeof ResolvedMovieMetadata>;
export type ResolvedMovieMetadataResult = ResolvedMovieMetadata | null;
