from typing import Literal

from pydantic import BaseModel, Field, PositiveInt


class AccessTokenModel(BaseModel):
    access_token: str
    refresh_token: str
    state: str
    id_token: str
    token_type: Literal['Bearer']
    expires_in: PositiveInt


class IDTokenACRModel(BaseModel):
    twoAF: str = Field(alias='2fa')


class IDTokenSBJModel(BaseModel):
    lvl: str = Field(alias='urn:esia:sbj:lvl')
    typ: str = Field(alias='urn:esia:sbj:typ')
    is_tru: bool = Field(alias='urn:esia:sbj:is_tru')
    oid: int = Field(alias='urn:esia:sbj:oid')
    name: str = Field(alias='urn:esia:sbj:nam')


class IDTokenModel(BaseModel):
    aud: str
    sub: int
    nbf: int
    amr: str
    auth_time: int
    exp: int
    iat: int
    iss: str
    # acr: IDTokenACRModel
    urn_esia_amd: str = Field(alias='urn:esia:amd')
    urn_esia_sid: str = Field(alias='urn:esia:sid')
    urn_esia_sbj: IDTokenSBJModel = Field(alias='urn:esia:sbj')


class UserInfoModel(BaseModel):
    stateFacts: list[str]
    firstName: str
    lastName: str
    middleName: str
    # birthDate: str
    # gender: str
    trusted: bool
    # citizenship: str
    snils: str
    inn: int
    updatedOn: int
    rfgUOperatorCheck: bool
    status: str
    verifying: bool
    rIdDoc: int
    containsUpCfmCode: bool
    kidAccCreatedByParent: bool
    eTag: str
