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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .loyalty_program_reward_definition import LoyaltyProgramRewardDefinition
from .catalog_object_reference import CatalogObjectReference
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class LoyaltyProgramRewardTier(UncheckedBaseModel):
    """
    Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-assigned ID of the reward tier.
    """

    points: int = pydantic.Field()
    """
    The points exchanged for the reward tier.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The name of the reward tier.
    """

    definition: typing.Optional[LoyaltyProgramRewardDefinition] = pydantic.Field(default=None)
    """
    Provides details about the reward tier definition.
    DEPRECATED at version 2020-12-16. Replaced by the `pricing_rule_reference` field.
    """

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

    pricing_rule_reference: CatalogObjectReference = pydantic.Field()
    """
    A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount.
    
    Use `object_id` and `catalog_version` with the [RetrieveCatalogObject](api-endpoint:Catalog-RetrieveCatalogObject) endpoint
    to get discount details. Make sure to set `include_related_objects` to true in the request to retrieve all catalog objects
    that define the discount. For more information, see [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details).
    """

    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
