package lobby import ( "fmt" "time" ) // Config configures the matchmaking pool's robot substitution. type Config struct { // RobotWait is how long an auto-match player waits for a human before a robot // is substituted. Sourced from BACKEND_LOBBY_ROBOT_WAIT. RobotWait time.Duration // ReaperInterval is how often the substitution reaper scans for over-waited // players. Sourced from BACKEND_LOBBY_REAPER_INTERVAL. ReaperInterval time.Duration } // DefaultConfig returns the matchmaking defaults: a 10-second wait // (docs/ARCHITECTURE.md ยง7) scanned every second. func DefaultConfig() Config { return Config{ RobotWait: 10 * time.Second, ReaperInterval: time.Second, } } // Validate reports whether the configuration is usable. func (c Config) Validate() error { if c.RobotWait <= 0 { return fmt.Errorf("lobby: robot wait must be positive, got %s", c.RobotWait) } if c.ReaperInterval <= 0 { return fmt.Errorf("lobby: reaper interval must be positive, got %s", c.ReaperInterval) } return nil }