-- Rate limiting configuration per tenant.
-- Rows are optional — absent tenant_id falls back to application defaults.
CREATE TABLE IF NOT EXISTS rate_limit_configs (
    tenant_id        TEXT        PRIMARY KEY,
    requests_per_min INT         NOT NULL DEFAULT 1000, -- tenant-wide RPM
    burst_size       INT         NOT NULL DEFAULT 200,  -- burst capacity
    user_rpm         INT         NOT NULL DEFAULT 100,  -- per-user RPM within tenant
    user_burst       INT         NOT NULL DEFAULT 20,   -- per-user burst
    is_enabled       BOOLEAN     NOT NULL DEFAULT TRUE,
    created_at       TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at       TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
