CREATE TABLE scrape_schedules (
    id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    day_of_week SMALLINT NOT NULL CHECK (day_of_week BETWEEN 0 AND 6),
    hour        SMALLINT NOT NULL CHECK (hour BETWEEN 0 AND 23),
    minute      SMALLINT NOT NULL DEFAULT 0 CHECK (minute BETWEEN 0 AND 59),
    UNIQUE (day_of_week, hour, minute)
);

-- Planning par défaut : lun-ven à 6h et 15h, week-end à 6h uniquement
INSERT INTO scrape_schedules (day_of_week, hour, minute) VALUES
    (1, 6, 0), (1, 15, 0),
    (2, 6, 0), (2, 15, 0),
    (3, 6, 0), (3, 15, 0),
    (4, 6, 0), (4, 15, 0),
    (5, 6, 0), (5, 15, 0),
    (6, 6, 0),
    (0, 6, 0);
