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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .checkout_options import CheckoutOptions
from .pre_populated_data import PrePopulatedData
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class PaymentLink(UncheckedBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-assigned ID of the payment link.
    """

    version: int = pydantic.Field()
    """
    The Square-assigned version number, which is incremented each time an update is committed to the payment link.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    The optional description of the `payment_link` object.
    It is primarily for use by your application and is not used anywhere.
    """

    order_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the order associated with the payment link.
    """

    checkout_options: typing.Optional[CheckoutOptions] = pydantic.Field(default=None)
    """
    The checkout options configured for the payment link.
    For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations).
    """

    pre_populated_data: typing.Optional[PrePopulatedData] = pydantic.Field(default=None)
    """
    Describes buyer data to prepopulate
    on the checkout page.
    """

    url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The shortened URL of the payment link.
    """

    long_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The long URL of the payment link.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp when the payment link was created, in RFC 3339 format.
    """

    updated_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp when the payment link was last updated, in RFC 3339 format.
    """

    payment_note: typing.Optional[str] = pydantic.Field(default=None)
    """
    An optional note. After Square processes the payment, this note is added to the
    resulting `Payment`.
    """

    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
