from enum import Enum from typing import Union, List from fastapi_camelcase import CamelModel from pydantic import conint, confloat, constr CountryCode = constr(to_lower=True, min_length=2, max_length=2) class GenMethodEnum(str, Enum): rsv = "RANDOMSTREETVIEW" urban = "URBAN" diff_tiered = "DIFFICULTY_TIERED" class GameModeEnum(str, Enum): normal = "NORMAL" frozen = "FROZEN" gun_game = "GUN_GAME" class ClockModeEnum(str, Enum): normal = "NORMAL" race = "RACE" time_bank = "TIMEBANK" class ScoreMethodEnum(str, Enum): distance = "DISTANCE" country_distance = "COUNTRYDIST" country_race = "COUNTRYRACE" hard = "HARD" nightmare = "NIGHTMARE" ramp = "RAMP" ramp_hard = "RAMP_HARD" class GameConfig(CamelModel): timer: conint(gt=0) rounds: conint(gt=0) country_lock: Union[CountryCode, None] = None generation_method: GenMethodEnum = GenMethodEnum.rsv game_mode: GameModeEnum = GameModeEnum.normal clock_mode: ClockModeEnum = ClockModeEnum.normal score_method: ScoreMethodEnum = ScoreMethodEnum.distance round_point_cap: Union[int, None] = None class Config: orm_mode = True class Guess(CamelModel): lat: confloat(ge=-90.0, le=90.0) lng: confloat(ge=-180.0, le=180.0) time_remaining: int class CacheInfo(CamelModel): cache_name: str size: int class GeneratorInfo(CamelModel): generation_method: GenMethodEnum country_locks: List[CountryCode]