-- Migration: curated_domains
-- Länderspezifische Curated-Domain-Vorschläge für die VIP-Layer-2-Liste.
-- User schlagen Glücksspielseiten ihres Landes vor; status='approved'-Einträge
-- werden vom webcontent-domains-Endpoint zusätzlich zur statischen
-- gambling-domains.json komponiert. Approve/Reject erfolgt admin-seitig.

CREATE TABLE "rebreak"."curated_domains" (
    "id"                   UUID         NOT NULL DEFAULT gen_random_uuid(),
    "domain"               TEXT         NOT NULL,
    "country"              TEXT         NOT NULL,
    "status"               TEXT         NOT NULL DEFAULT 'suggested',
    "suggested_by_user_id" UUID,
    "created_at"           TIMESTAMPTZ  NOT NULL DEFAULT NOW(),
    "reviewed_at"          TIMESTAMPTZ,

    CONSTRAINT "curated_domains_pkey" PRIMARY KEY ("id")
);

CREATE UNIQUE INDEX "curated_domains_country_domain_key" ON "rebreak"."curated_domains"("country", "domain");
CREATE INDEX "curated_domains_country_status_idx" ON "rebreak"."curated_domains"("country", "status");
