-- Release calendar: upcoming/past sneaker launches
-- Managed via admin Content module

CREATE TABLE IF NOT EXISTS releases (
  id             UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  slug           TEXT UNIQUE NOT NULL,
  title          TEXT NOT NULL,
  brand          TEXT NOT NULL,
  model          TEXT,
  colorway       TEXT,
  release_date   DATE NOT NULL,
  release_time   TIME,
  price_eur      DECIMAL(10,2),
  style_code     TEXT,
  image_url      TEXT,
  product_id     UUID,
  description    TEXT,
  hype_score     SMALLINT DEFAULT 0,
  status         TEXT NOT NULL DEFAULT 'upcoming',
  sources        JSONB DEFAULT '[]',
  created_at     TIMESTAMPTZ NOT NULL DEFAULT now(),
  updated_at     TIMESTAMPTZ NOT NULL DEFAULT now()
);

CREATE INDEX IF NOT EXISTS idx_releases_date ON releases (release_date DESC);
CREATE INDEX IF NOT EXISTS idx_releases_status ON releases (status, release_date);
CREATE INDEX IF NOT EXISTS idx_releases_brand ON releases (brand, release_date DESC);
