export interface Prompt {
    id: number;
    title: string;
    prompt: string;
    category: string;
    category_type?: string;
    description: string;
    images: string[];
    author: string;
    source: string;
    source_url: string;
    published?: string;
    tags?: string[];
    createdAt?: number; // Timestamp
    useCount?: number;
    lastUsedAt?: number; // Timestamp
}

export interface PromptCache {
    lastSync?: number;
    last_updated: string | null;
    categories: Record<string, string[]>;
    total_count: number;
    sources: string[];
    prompts: Prompt[];
}

// Whisk API Types

export interface WhiskAuthResponse {
    access_token?: string;
    error?: string;
}

export interface WhiskUploadResponse {
    result?: {
        data?: {
            json?: {
                result?: {
                    uploadMediaGenerationId?: string;
                }
            }
        }
    }
}

export interface GeneratedImagePanel {
    generatedImages?: Array<{
        encodedImage?: string;
    }>;
}

export interface WhiskGenerateResponse {
    imagePanels?: GeneratedImagePanel[];
}

export interface MediaInput {
    mediaInput: {
        mediaCategory: string;
        mediaGenerationId: string;
    }
}

export interface WhiskPayloadClientContext {
    workflowId: string;
    tool: string;
    sessionId: string;
}

export interface WhiskPayloadImageModelSettings {
    imageModel: string;
    aspectRatio: string;
    prompt?: string;
    seed?: number;
}

export interface WhiskGeneratePayload {
    clientContext: WhiskPayloadClientContext;
    imageModelSettings: WhiskPayloadImageModelSettings;
    seed?: number; // Sometimes at root? Keeping consistent with existing logic
}

export interface WhiskRecipePayload {
    clientContext: WhiskPayloadClientContext;
    imageModelSettings: {
        imageModel: string;
        aspectRatio: string;
    };
    media_inputs: MediaInput[];
    prompt: string;
}

// Whisk Video Generation Types
export interface WhiskVideoGenerateResponse {
    videoGenerationId?: string;
    status?: string;
    error?: string;
}

export interface WhiskVideoOperationResponse {
    operation: {
        operation: {
            name: string; // "44f03bf2a50bc4da8700b14104b0c4c6"
        };
        sceneId: string;
        status: string; // "MEDIA_GENERATION_STATUS_PENDING"
    };
}

export interface WhiskVideoStatusResponse {
    status?: string;
    state?: string;
    videoUrl?: string; // TBD
    video?: {
        url?: string;
        encodedVideo?: string;
    };
    encodedVideo?: string;
    error?: string;
}

export interface WhiskVideoResult {
    id: string;
    url?: string;
    status: 'pending' | 'COMPLETED' | 'FAILED';
}
