# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: steammessages_auth.steamclient.proto
# plugin: python-betterproto
# Last updated 02/09/2022

from dataclasses import dataclass

import betterproto

from .base import CMsgIpAddress
from .emsg import EMsg
from .msg import UnifiedMessage


class EAuthTokenPlatformType(betterproto.Enum):
    Unknown = 0
    SteamClient = 1
    WebBrowser = 2
    MobileApp = 3


class EAuthSessionGuardType(betterproto.Enum):
    Unknown = 0
    NONE = 1
    EmailCode = 2
    DeviceCode = 3
    DeviceConfirmation = 4
    EmailConfirmation = 5
    MachineToken = 6


class EAuthSessionSecurityHistory(betterproto.Enum):
    Invalid = 0
    UsedPreviously = 1
    NoPriorHistory = 2


class EAuthTokenState(betterproto.Enum):
    Invalid = 0
    New = 1
    Confirmed = 2
    Issued = 3
    Denied = 4
    LoggedOut = 5
    Revoked = 99


class ESessionPersistence(betterproto.Enum):
    Invalid = -1
    Ephemeral = 0
    Persistent = 1


class GenerateAccessTokenForAppRequest(UnifiedMessage, um_name="Authentication.GenerateAccessTokenForApp"):
    refresh_token: str = betterproto.string_field(1)
    steamid: int = betterproto.fixed64_field(2)


class GenerateAccessTokenForAppResponse(UnifiedMessage, um_name="Authentication.GenerateAccessTokenForApp"):
    access_token: str = betterproto.string_field(1)
    refresh_token: str = betterproto.string_field(2)


class GetPasswordRsaPublicKeyRequest(
    UnifiedMessage,
    msg=EMsg.ServiceMethodCallFromClientNonAuthed,
    um_name="Authentication.GetPasswordRSAPublicKey",
):
    account_name: str = betterproto.string_field(1)


class GetPasswordRsaPublicKeyResponse(UnifiedMessage, um_name="Authentication.GetPasswordRSAPublicKey"):
    publickey_mod: str = betterproto.string_field(1)
    publickey_exp: str = betterproto.string_field(2)
    timestamp: int = betterproto.uint64_field(3)


class BeginAuthSessionViaQrRequest(UnifiedMessage, um_name="Authentication.BeginAuthSessionViaQR"):
    device_friendly_name: str = betterproto.string_field(1)
    platform_type: EAuthTokenPlatformType = betterproto.enum_field(2)


@dataclass(eq=False, repr=False)
class AllowedConfirmation(betterproto.Message):
    confirmation_type: EAuthSessionGuardType = betterproto.enum_field(1)
    associated_message: str = betterproto.string_field(2)


class BeginAuthSessionViaQrResponse(UnifiedMessage, um_name="Authentication.BeginAuthSessionViaQR"):
    client_id: int = betterproto.uint64_field(1)
    challenge_url: str = betterproto.string_field(2)
    request_id: bytes = betterproto.bytes_field(3)
    interval: float = betterproto.float_field(4)
    allowed_confirmations: list[AllowedConfirmation] = betterproto.message_field(5)
    version: int = betterproto.int32_field(6)


class BeginAuthSessionViaCredentialsRequest(
    UnifiedMessage,
    msg=EMsg.ServiceMethodCallFromClientNonAuthed,
    um_name="Authentication.BeginAuthSessionViaCredentials",
):
    device_friendly_name: str = betterproto.string_field(1)
    account_name: str = betterproto.string_field(2)
    encrypted_password: str = betterproto.string_field(3)
    encryption_timestamp: int = betterproto.uint64_field(4)
    platform_type: EAuthTokenPlatformType = betterproto.enum_field(6)
    persistence: ESessionPersistence = betterproto.enum_field(7)
    website_id: str = betterproto.string_field(8)


class BeginAuthSessionViaCredentialsResponse(UnifiedMessage, um_name="Authentication.BeginAuthSessionViaCredentials"):
    client_id: int = betterproto.uint64_field(1)
    request_id: bytes = betterproto.bytes_field(2)
    interval: float = betterproto.float_field(3)
    allowed_confirmations: list[AllowedConfirmation] = betterproto.message_field(4)
    steamid: int = betterproto.uint64_field(5)
    weak_token: str = betterproto.string_field(6)


class PollAuthSessionStatusRequest(
    UnifiedMessage, um_name="Authentication.PollAuthSessionStatus", msg=EMsg.ServiceMethodCallFromClientNonAuthed
):
    client_id: int = betterproto.uint64_field(1)
    request_id: bytes = betterproto.bytes_field(2)
    token_to_revoke: int = betterproto.fixed64_field(3)


class PollAuthSessionStatusResponse(UnifiedMessage, um_name="Authentication.PollAuthSessionStatus"):
    new_client_id: int = betterproto.uint64_field(1)
    new_challenge_url: str = betterproto.string_field(2)
    refresh_token: str = betterproto.string_field(3)
    access_token: str = betterproto.string_field(4)
    had_remote_interaction: bool = betterproto.bool_field(5)
    account_name: str = betterproto.string_field(6)


class GetAuthSessionInfoRequest(UnifiedMessage, um_name="Authentication.GetAuthSessionInfo"):
    client_id: int = betterproto.uint64_field(1)


class GetAuthSessionInfoResponse(UnifiedMessage, um_name="Authentication.GetAuthSessionInfo"):
    ip: str = betterproto.string_field(1)
    geoloc: str = betterproto.string_field(2)
    city: str = betterproto.string_field(3)
    state: str = betterproto.string_field(4)
    country: str = betterproto.string_field(5)
    platform_type: EAuthTokenPlatformType = betterproto.enum_field(6)
    device_friendly_name: str = betterproto.string_field(7)
    version: int = betterproto.int32_field(8)
    login_history: EAuthSessionSecurityHistory = betterproto.enum_field(9)
    requestor_location_mismatch: bool = betterproto.bool_field(10)
    high_usage_login: bool = betterproto.bool_field(11)
    requested_persistence: ESessionPersistence = betterproto.enum_field(12)


class UpdateAuthSessionWithMobileConfirmationRequest(
    UnifiedMessage, um_name="Authentication.UpdateAuthSessionWithMobileConfirmation"
):
    version: int = betterproto.int32_field(1)
    client_id: int = betterproto.uint64_field(2)
    steamid: int = betterproto.fixed64_field(3)
    signature: bytes = betterproto.bytes_field(4)
    confirm: bool = betterproto.bool_field(5)
    persistence: ESessionPersistence = betterproto.enum_field(6)


class UpdateAuthSessionWithMobileConfirmationResponse(
    UnifiedMessage, um_name="Authentication.UpdateAuthSessionWithMobileConfirmation"
):
    pass


class UpdateAuthSessionWithSteamGuardCodeRequest(
    UnifiedMessage,
    um_name="Authentication.UpdateAuthSessionWithSteamGuardCode",
    msg=EMsg.ServiceMethodCallFromClientNonAuthed,
):
    client_id: int = betterproto.uint64_field(1)
    steamid: int = betterproto.fixed64_field(2)
    code: str = betterproto.string_field(3)
    code_type: EAuthSessionGuardType = betterproto.enum_field(4)


class UpdateAuthSessionWithSteamGuardCodeResponse(
    UnifiedMessage, um_name="Authentication.UpdateAuthSessionWithSteamGuardCode"
):
    pass


class AccessTokenGenerateForAppRequest(UnifiedMessage, um_name="Authentication.AccessTokenGenerateForApp"):
    refresh_token: str = betterproto.string_field(1)
    steamid: int = betterproto.fixed64_field(2)


class AccessTokenGenerateForAppResponse(UnifiedMessage, um_name="Authentication.AccessTokenGenerateForApp"):
    access_token: str = betterproto.string_field(1)


class GetAuthSessionsForAccountRequest(UnifiedMessage, um_name="Authentication.GetAuthSessionsForAccount"):
    pass


class GetAuthSessionsForAccountResponse(UnifiedMessage, um_name="Authentication.GetAuthSessionsForAccount"):
    client_ids: list[int] = betterproto.uint64_field(1)


class MigrateMobileSessionRequest(UnifiedMessage, um_name="Authentication.MigrateMobileSession"):
    steamid: int = betterproto.fixed64_field(1)
    token: str = betterproto.string_field(2)
    signature: str = betterproto.string_field(3)


class MigrateMobileSessionResponse(UnifiedMessage, um_name="Authentication.MigrateMobileSession"):
    refresh_token: str = betterproto.string_field(1)
    access_token: str = betterproto.string_field(2)


class SupportQueryRefreshTokensByAccountRequest(
    UnifiedMessage, um_name="AuthenticationSupport.QueryRefreshTokensByAccount"
):
    steamid: int = betterproto.fixed64_field(1)
    include_revoked_tokens: bool = betterproto.bool_field(2)


@dataclass(eq=False, repr=False)
class RefreshTokenDescription(betterproto.Message):
    token_id: int = betterproto.fixed64_field(1)
    token_description: str = betterproto.string_field(2)
    time_updated: int = betterproto.uint32_field(3)
    platform_type: EAuthTokenPlatformType = betterproto.enum_field(4)
    token_state: EAuthTokenState = betterproto.enum_field(5)
    owner_steamid: int = betterproto.fixed64_field(6)


class QueryRefreshTokensByAccountResponse(UnifiedMessage, um_name="AuthenticationSupport.QueryRefreshTokensByAccount"):
    refresh_tokens: list[RefreshTokenDescription] = betterproto.message_field(1)


class QueryRefreshTokenByIdRequest(UnifiedMessage, um_name="AuthenticationSupport.QueryRefreshTokenByID"):
    token_id: int = betterproto.fixed64_field(1)


class QueryRefreshTokenByIdResponse(UnifiedMessage, um_name="AuthenticationSupport.QueryRefreshTokenByID"):
    refresh_tokens: list[RefreshTokenDescription] = betterproto.message_field(1)


class RevokeTokenRequest(UnifiedMessage, um_name="AuthenticationSupport.RevokeToken"):
    token_id: int = betterproto.fixed64_field(1)


class RevokeTokenResponse(UnifiedMessage, um_name="AuthenticationSupport.RevokeToken"):
    pass


class GetTokenHistoryRequest(UnifiedMessage, um_name="AuthenticationSupport.GetTokenHistory"):
    token_id: int = betterproto.fixed64_field(1)


@dataclass(eq=False, repr=False)
class RefreshTokenAudit(betterproto.Message):
    action: int = betterproto.int32_field(1)
    time: int = betterproto.uint32_field(2)
    ip: CMsgIpAddress = betterproto.message_field(3)
    actor: int = betterproto.fixed64_field(4)


class GetTokenHistoryResponse(UnifiedMessage, um_name="AuthenticationSupport.GetTokenHistory"):
    history: list[RefreshTokenAudit] = betterproto.message_field(1)


class CreateNonceRequest(UnifiedMessage, um_name="Authentication.CreateNonce"):
    platform: str = betterproto.string_field(1)
    appid: int = betterproto.uint32_field(2)


class CreateNonceResponse(UnifiedMessage, um_name="Authentication.CreateNonce"):
    nonce: str = betterproto.string_field(1)
    expiry: int = betterproto.uint32_field(2)


class GetTimeRemainingRequest(UnifiedMessage, um_name="Authentication.GetTimeRemaining"):
    platform: str = betterproto.string_field(1)
    appid_list: list[int] = betterproto.uint32_field(2)


@dataclass(eq=False, repr=False)
class TimeRemaining(betterproto.Message):
    appid: int = betterproto.uint32_field(1)
    minutes_remaining: int = betterproto.uint32_field(2)


class GetTimeRemainingResponse(UnifiedMessage, um_name="Authentication.GetTimeRemaining"):
    entries: list[TimeRemaining] = betterproto.message_field(2)
