import { z } from "zod";
import type {
	MetadataSearchResult,
	PersonInfo,
	ResolvedPersonResult,
} from "@/models";
import type { IProviderLifecycle } from "./lifecycle";

/**
 * Person search query schema
 */
export const PersonSearchQuery = z.object({
	name: z.string(),
});

export type PersonSearchQuery = z.infer<typeof PersonSearchQuery>;

/**
 * Person search result interface
 * Uses base metadata search result structure filtered for person results
 */
export type PersonSearchResult = MetadataSearchResult;

/**
 * Base interface for person/actor metadata providers
 * Providers implementing this interface can supply person/actor biographical information
 * Extends IProviderLifecycle for mount/dispose capabilities
 */
export interface BasePersonProvider extends IProviderLifecycle {
	/**
	 * Search for people/actors by name
	 * @param query - Search query containing person name
	 * @returns Promise resolving to search results with person matches
	 */
	search(query: PersonSearchQuery): Promise<PersonSearchResult>;

	/**
	 * Resolve detailed person metadata
	 * @param info - Person information containing personId
	 * @returns Promise resolving to complete person metadata or null if not found
	 */
	resolve(info: PersonInfo): Promise<ResolvedPersonResult>;
}
