from enum import Enum from typing import Union from fastapi_camelcase import CamelModel from pydantic import conint, confloat, constr class GenMethodEnum(str, Enum): # map_crunch = "MAPCRUNCH" rsv = "RANDOMSTREETVIEW" # urban = "URBAN" class RuleSetEnum(str, Enum): normal = "NORMAL" time_bank = "TIMEBANK" frozen = "FROZEN" race = "RACE" class GameConfig(CamelModel): timer: conint(gt=0) rounds: conint(gt=0) country_lock: Union[constr(to_lower=True, min_length=2, max_length=2), None] = None generation_method: GenMethodEnum = GenMethodEnum.rsv rule_set: RuleSetEnum = RuleSetEnum.normal 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