import Dexie, { Table } from 'dexie';

export interface ImageItem {
    id?: number;
    data: string; // Base64 or URL
    prompt: string;
    aspectRatio: string;
    createdAt: number;
    provider?: 'whisk' | 'meta'; // Track which AI generated the image
}

export class KeyValuePixDB extends Dexie {
    gallery!: Table<ImageItem, number>;

    constructor() {
        super('kv-pix-db');
        this.version(1).stores({
            gallery: '++id, createdAt'
        });
    }
}

export const db = new KeyValuePixDB();
