import type {
    IMovie as IMovieBase,
    IMovieDetails as IMovieDetailsBase
} from "@autoplex-api/search";

/**
 * Basic user information schema
 */
export interface IUser {
	id     : number,
	name   : string,
	isAdmin: boolean
}

/**
 * The JWT auth token structure
 */
export interface ITokenSchema extends IUser {
	iat: number,
	exp: number
}

/**
 * The general API response structure
 */
export interface IApiResponse {
    errors?: any[]
	status: string
}

/**
 * A generic data response from the API
 */
export interface IApiDataResponse<T> extends IApiResponse {
	result: T
}

/**
 * A generic data response conatining paginated results
 */
export type IPaginatedResponse<T> = IApiDataResponse<{
    page: number,
    results: T[]
    totalPages: number,
    totalResults: number
}>;

/**
 * Movie request information schema
 */
interface IMovieRequestInfo {
    plexLink: string | null,
    ticketId: number | null
}

/**
 * General movie information schema
 */
export interface IMovie extends IMovieBase, IMovieRequestInfo {}

/**
 * Detailed movie information schema
 */
export interface IMovieDetails extends IMovieDetailsBase, IMovieRequestInfo {
    requestedBy: null | {
        id     : number,
        isAdmin: boolean,
        name   : string
    }
}
