-- 053_scraper_settings.sql
-- Таблица настроек парсеров: задержки между запросами (anti-ban), extensible.
-- Одна строка на источник (source); UNIQUE(source).
BEGIN;

CREATE TABLE IF NOT EXISTS scraper_settings (
    id               SERIAL PRIMARY KEY,
    source           TEXT        NOT NULL,
    request_delay_sec NUMERIC(6,2) NOT NULL DEFAULT 5.0,
    description      TEXT,
    created_at       TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at       TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    CONSTRAINT scraper_settings_source_uq UNIQUE (source)
);

COMMENT ON TABLE scraper_settings IS
    'Per-source scraper delay settings. Special source=''global'' acts as floor across all scrapers.';

COMMIT;
