"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from enum import Enum
from polar_sdk.types import BaseModel
from polar_sdk.utils import FieldMetadata, validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing_extensions import Annotated, TypedDict


class Onev11oauth21tokenPostXComponentsRefreshTokenRequestGrantType(str, Enum):
    REFRESH_TOKEN = "refresh_token"


class Onev11oauth21tokenPostXComponentsRefreshTokenRequestTypedDict(TypedDict):
    client_id: str
    client_secret: str
    refresh_token: str
    grant_type: Onev11oauth21tokenPostXComponentsRefreshTokenRequestGrantType


class Onev11oauth21tokenPostXComponentsRefreshTokenRequest(BaseModel):
    client_id: Annotated[str, FieldMetadata(form=True)]

    client_secret: Annotated[str, FieldMetadata(form=True)]

    refresh_token: Annotated[str, FieldMetadata(form=True)]

    GRANT_TYPE: Annotated[
        Annotated[
            Onev11oauth21tokenPostXComponentsRefreshTokenRequestGrantType,
            AfterValidator(
                validate_const(
                    Onev11oauth21tokenPostXComponentsRefreshTokenRequestGrantType.REFRESH_TOKEN
                )
            ),
        ],
        pydantic.Field(alias="grant_type"),
        FieldMetadata(form=True),
    ] = Onev11oauth21tokenPostXComponentsRefreshTokenRequestGrantType.REFRESH_TOKEN
