-- Cache metadata table for tracking API fetch times and TTL

CREATE TABLE IF NOT EXISTS cache_metadata (
    key TEXT PRIMARY KEY,
    last_fetch DATETIME NOT NULL,
    ttl_minutes INTEGER NOT NULL DEFAULT 5,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

-- Pre-populate with cache keys
INSERT OR IGNORE INTO cache_metadata (key, last_fetch, ttl_minutes) VALUES
    ('todoist_tasks', '2000-01-01 00:00:00', 5),
    ('todoist_projects', '2000-01-01 00:00:00', 5),
    ('obsidian_notes', '2000-01-01 00:00:00', 5),
    ('plantoeat_meals', '2000-01-01 00:00:00', 5),
    ('trello_boards', '2000-01-01 00:00:00', 5),
    ('trello_cards', '2000-01-01 00:00:00', 5);
