-- Persistent event-driven notifications (level-ups, loan expiry, season end, etc.)
-- Dynamic state notifications (expiring loans, unclaimed objectives) remain in code.
CREATE TABLE IF NOT EXISTS notifications (
    id          TEXT    PRIMARY KEY,
    kind        TEXT    NOT NULL,
    title       TEXT    NOT NULL,
    body        TEXT    NOT NULL,
    is_read     INTEGER NOT NULL DEFAULT 0,
    created_at  TEXT    NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_notifications_is_read ON notifications (is_read);
CREATE INDEX IF NOT EXISTS idx_notifications_created  ON notifications (created_at DESC);
