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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .error import Error
from .loyalty_event import LoyaltyEvent


class AccumulateLoyaltyPointsResponse(UncheckedBaseModel):
    """
    Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response.
    """

    errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
    """
    Any errors that occurred during the request.
    """

    event: typing.Optional[LoyaltyEvent] = pydantic.Field(default=None)
    """
    The resulting loyalty event. Starting in Square version 2022-08-17, this field is no longer returned.
    """

    events: typing.Optional[typing.List[LoyaltyEvent]] = pydantic.Field(default=None)
    """
    The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event
    is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included
    if the purchase also qualifies for a loyalty promotion.
    """

    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
