CREATE TABLE IF NOT EXISTS claim_requests (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  tenant_id BIGINT UNSIGNED NOT NULL,
  location_id BIGINT UNSIGNED NOT NULL,

  order_id BIGINT UNSIGNED NOT NULL,
  customer_id BIGINT UNSIGNED NULL,

  token VARCHAR(80) NOT NULL,

  -- input kasir (rupiah)
  offer_amount DECIMAL(14,2) NOT NULL DEFAULT 0.00,

  -- hasil keputusan sistem
  decision_status ENUM('APPROVED','ADJUSTED','REJECTED','OVERRIDE') NOT NULL DEFAULT 'APPROVED',
  decided_amount DECIMAL(14,2) NOT NULL DEFAULT 0.00,

  -- status yang dilihat POS setelah customer klik landing
  claim_status ENUM('OFFERED','CLAIMED','CANCELLED') NOT NULL DEFAULT 'OFFERED',

  override_reason VARCHAR(255) NULL,
  decided_by_user_id BIGINT UNSIGNED NULL,

  offered_at DATETIME NULL,
  claimed_at DATETIME NULL,
  created_at DATETIME NULL,
  updated_at DATETIME NULL,

  UNIQUE KEY uniq_claim_token (token),
  KEY idx_claim_order (tenant_id, location_id, order_id),
  KEY idx_claim_month (tenant_id, location_id, created_at)
);