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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .money import Money
from .dispute_reason import DisputeReason
from .dispute_state import DisputeState
from .disputed_payment import DisputedPayment
from .card_brand import CardBrand
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Dispute(UncheckedBaseModel):
    """
    Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank.
    """

    dispute_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique ID for this `Dispute`, generated by Square.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique ID for this `Dispute`, generated by Square.
    """

    amount_money: typing.Optional[Money] = pydantic.Field(default=None)
    """
    The disputed amount, which can be less than the total transaction amount.
    For instance, if multiple items were purchased but the cardholder only initiates a dispute over some of the items.
    """

    reason: typing.Optional[DisputeReason] = pydantic.Field(default=None)
    """
    The reason why the cardholder initiated the dispute.
    See [DisputeReason](#type-disputereason) for possible values
    """

    state: typing.Optional[DisputeState] = pydantic.Field(default=None)
    """
    The current state of this dispute.
    See [DisputeState](#type-disputestate) for possible values
    """

    due_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates).
    """

    disputed_payment: typing.Optional[DisputedPayment] = pydantic.Field(default=None)
    """
    The payment challenged in this dispute.
    """

    evidence_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The IDs of the evidence associated with the dispute.
    """

    card_brand: typing.Optional[CardBrand] = pydantic.Field(default=None)
    """
    The card brand used in the disputed payment.
    See [CardBrand](#type-cardbrand) for possible values
    """

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

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

    brand_dispute_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the dispute in the card brand system, generated by the card brand.
    """

    reported_date: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp when the dispute was reported, in RFC 3339 format.
    """

    reported_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp when the dispute was reported, in RFC 3339 format.
    """

    version: typing.Optional[int] = pydantic.Field(default=None)
    """
    The current version of the `Dispute`.
    """

    location_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the location where the dispute originated.
    """

    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
