# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: steammessages_gameservers.proto
# plugin: python-betterproto
# Last updated 18/05/2022

from dataclasses import dataclass

import betterproto

from .base import CMsgIpAddress
from .msg import UnifiedMessage


class EQueryType(betterproto.Enum):
    Invalid = 0
    Ping = 1
    Players = 2
    Rules = 3


class GetServerListRequest(UnifiedMessage, um_name="GameServers.GetServerList"):
    filter: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)


class GetServerListResponse(UnifiedMessage, um_name="GameServers.GetServerList"):
    servers: "list[GetServerListResponseServer]" = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class GetServerListResponseServer(betterproto.Message):
    addr: str = betterproto.string_field(1)
    gameport: int = betterproto.uint32_field(2)
    specport: int = betterproto.uint32_field(3)
    steamid: int = betterproto.fixed64_field(4)
    name: str = betterproto.string_field(5)
    appid: int = betterproto.uint32_field(6)
    gamedir: str = betterproto.string_field(7)
    version: str = betterproto.string_field(8)
    product: str = betterproto.string_field(9)
    region: int = betterproto.int32_field(10)
    players: int = betterproto.int32_field(11)
    max_players: int = betterproto.int32_field(12)
    bots: int = betterproto.int32_field(13)
    map: str = betterproto.string_field(14)
    secure: bool = betterproto.bool_field(15)
    dedicated: bool = betterproto.bool_field(16)
    os: str = betterproto.string_field(17)
    gametype: str = betterproto.string_field(18)


class GetServerSteamIDsByIpRequest(UnifiedMessage, um_name="GameServers.GetServerSteamIDsByIP"):
    server_ips: list[str] = betterproto.string_field(1)


class IPsWithSteamIDsResponse(UnifiedMessage, um_name="GameServers.GetServerSteamIDsByIP"):
    servers: "list[IPsWithSteamIDsResponseServer]" = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class IPsWithSteamIDsResponseServer(betterproto.Message):
    addr: str = betterproto.string_field(1)
    steamid: int = betterproto.fixed64_field(2)


class GetServerIPsBySteamIdRequest(UnifiedMessage, um_name="GameServers.GetServerIPsBySteamID"):
    server_steamids: list[int] = betterproto.fixed64_field(1)


class QueryRequest(UnifiedMessage, um_name="GameServers.QueryByFakeIP"):
    fake_ip: int = betterproto.uint32_field(1)
    fake_port: int = betterproto.uint32_field(2)
    app_id: int = betterproto.uint32_field(3)
    query_type: EQueryType = betterproto.enum_field(4)


@dataclass(eq=False, repr=False)
class PingQueryData(betterproto.Message):
    server_ip: CMsgIpAddress = betterproto.message_field(1)
    query_port: int = betterproto.uint32_field(2)
    game_port: int = betterproto.uint32_field(3)
    spectator_port: int = betterproto.uint32_field(4)
    spectator_server_name: str = betterproto.string_field(5)
    server_name: str = betterproto.string_field(6)
    steamid: int = betterproto.fixed64_field(7)
    app_id: int = betterproto.uint32_field(8)
    gamedir: str = betterproto.string_field(9)
    map: str = betterproto.string_field(10)
    game_description: str = betterproto.string_field(11)
    gametype: str = betterproto.string_field(12)
    num_players: int = betterproto.uint32_field(13)
    max_players: int = betterproto.uint32_field(14)
    num_bots: int = betterproto.uint32_field(15)
    password: bool = betterproto.bool_field(16)
    secure: bool = betterproto.bool_field(17)
    dedicated: bool = betterproto.bool_field(18)
    version: str = betterproto.string_field(19)
    sdr_popid: int = betterproto.fixed32_field(20)
    sdr_location_string: str = betterproto.string_field(21)


@dataclass(eq=False, repr=False)
class PlayersQueryDataPlayer(betterproto.Message):
    name: str = betterproto.string_field(1)
    score: int = betterproto.uint32_field(2)
    time_played: int = betterproto.uint32_field(3)


@dataclass(eq=False, repr=False)
class PlayersQueryData(betterproto.Message):
    players: list[PlayersQueryDataPlayer] = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class RulesQueryData(betterproto.Message):
    rules: dict[str, str] = betterproto.map_field(1, betterproto.TYPE_STRING, betterproto.TYPE_STRING)


class QueryResponse(UnifiedMessage, um_name="GameServers.QueryByFakeIP"):
    ping_data: PingQueryData = betterproto.message_field(1)
    players_data: PlayersQueryData = betterproto.message_field(2)
    rules_data: RulesQueryData = betterproto.message_field(3)
