-- WiFi Auth module settings per hotel
CREATE TABLE IF NOT EXISTS hotel_wifi_settings (
  id            UUID        PRIMARY KEY DEFAULT gen_random_uuid(),
  hotel_id      UUID        NOT NULL REFERENCES hotels(id) ON DELETE CASCADE,
  enabled       BOOLEAN     NOT NULL DEFAULT false,
  api_token     TEXT        NOT NULL DEFAULT encode(gen_random_bytes(32), 'hex'),
  auth_method   TEXT        NOT NULL DEFAULT 'room_any',
  -- room_lastname | room_birthdate | room_any | room_only
  ssid_name     TEXT,
  welcome_text  TEXT        DEFAULT 'Добро пожаловать! Введите данные для подключения к Wi-Fi.',
  session_hours INT         NOT NULL DEFAULT 24,
  created_at    TIMESTAMPTZ NOT NULL DEFAULT NOW(),
  updated_at    TIMESTAMPTZ NOT NULL DEFAULT NOW(),
  UNIQUE (hotel_id)
);
