# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .additional_data import AdditionalData
from .page_content import PageContent
from .page_identifier import PageIdentifier
from .page_setting import PageSetting
from .payabli_credentials import PayabliCredentials
from .receipt_content import ReceiptContent
from .subdomain import Subdomain


class PayabliPages(UniversalBaseModel):
    additional_data: typing_extensions.Annotated[
        typing.Optional[AdditionalData], FieldMetadata(alias="AdditionalData")
    ] = None
    credentials: typing.Optional[typing.List[PayabliCredentials]] = pydantic.Field(default=None)
    """
    Array of credential objects with active services for the page
    """

    last_access: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="lastAccess")] = (
        pydantic.Field(default=None)
    )
    """
    Timestamp of last access to page structure
    """

    page_content: typing_extensions.Annotated[typing.Optional[PageContent], FieldMetadata(alias="pageContent")] = (
        pydantic.Field(default=None)
    )
    """
    Sections of page
    """

    page_identifier: typing_extensions.Annotated[
        typing.Optional[PageIdentifier], FieldMetadata(alias="pageIdentifier")
    ] = None
    page_settings: typing_extensions.Annotated[typing.Optional[PageSetting], FieldMetadata(alias="pageSettings")] = (
        pydantic.Field(default=None)
    )
    """
    Settings of page
    """

    published: typing.Optional[int] = pydantic.Field(default=None)
    """
    Flag indicating if page is active to accept payments. `0` for false, `1` for true.
    """

    receipt_content: typing_extensions.Annotated[
        typing.Optional[ReceiptContent], FieldMetadata(alias="receiptContent")
    ] = pydantic.Field(default=None)
    """
    Sections of payment receipt
    """

    subdomain: typing.Optional[Subdomain] = pydantic.Field(default=None)
    """
    Page identifier. Must be unique in platform.
    """

    total_amount: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="totalAmount")] = (
        pydantic.Field(default=None)
    )
    """
    Total amount to pay in this page
    """

    validation_code: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="validationCode")] = (
        pydantic.Field(default=None)
    )
    """
    Base64 encoded image of CAPTCHA associated to this page load
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
