SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE DATABASE IF NOT EXISTS hyapp_game DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

USE hyapp_game;

CREATE TABLE IF NOT EXISTS game_room_rps_configs (
  app_code VARCHAR(32) NOT NULL COMMENT '应用编码，用于多租户隔离',
  game_id VARCHAR(96) NOT NULL COMMENT '房内猜拳游戏 ID',
  status VARCHAR(32) NOT NULL DEFAULT 'active' COMMENT '配置状态',
  challenge_timeout_ms BIGINT NOT NULL DEFAULT 600000 COMMENT '挑战无人应战超时毫秒数',
  reveal_countdown_ms BIGINT NOT NULL DEFAULT 3000 COMMENT '揭晓倒计时毫秒数',
  stake_gifts_json JSON NOT NULL COMMENT '四档礼物配置快照',
  created_at_ms BIGINT NOT NULL COMMENT '创建时间，UTC epoch ms',
  updated_at_ms BIGINT NOT NULL COMMENT '更新时间，UTC epoch ms',
  PRIMARY KEY(app_code, game_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='房内猜拳配置表';
