# https://developers.google.com/wallet/reference/rest/v1/smarttap

from enum import Enum
from typing import Annotated, Literal, Optional

from pydantic import BaseModel, Field
from typing_extensions import deprecated


class Action(str, Enum):
    ACTION_UNSPECIFIED = "ACTION_UNSPECIFIED"

    S2AP = "S2AP"

    s2ap = "s2ap"
    """
    Legacy alias for `S2AP`. Deprecated.
    """

    SIGN_UP = "SIGN_UP"

    signUp = "signUp"
    """
    Legacy alias for `SIGN_UP`. Deprecated.
    """


class SignUpInfo(BaseModel):
    classId: str
    """
    ID of the class the user can sign up for.
    """


class IssuerToUserInfo(BaseModel):
    action: Action

    url: Optional[str] = None
    """
    Currently not used, consider deprecating.
    """

    value: Optional[str] = None
    """
    JSON web token for action S2AP.
    """

    signUpInfo: Optional[SignUpInfo] = None


class SmartTap(BaseModel):
    kind: Annotated[
        Literal["walletobjects#smartTap"],
        deprecated("This item is deprecated!"),
    ] = "walletobjects#smartTap"
    """
    Identifies what kind of resource this is. Value: the fixed string
    `"walletobjects#smartTap"`.
    """

    id: str
    """
    The unique identifier for a smart tap. This value should follow the format
    `issuer ID.identifier` where the former is issued by Google and latter is
    the Smart Tap id. The Smart Tap id is a Base64 encoded string which
    represents the id which was generated by the Google Pay app.
    """

    merchantId: str
    """
    int64 format

    Smart Tap merchant ID of who engaged in the Smart Tap interaction.
    """

    infos: list[IssuerToUserInfo] = Field(default_factory=list)
    """
    Communication from merchant to user.
    """
