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

import enum
import typing

T_Result = typing.TypeVar("T_Result")


class CardBrand(str, enum.Enum):
    AMERICAN_EXPRESS = "AmericanExpress"
    DISCOVER = "Discover"
    MASTERCARD = "Mastercard"
    VISA = "Visa"

    def visit(
        self,
        american_express: typing.Callable[[], T_Result],
        discover: typing.Callable[[], T_Result],
        mastercard: typing.Callable[[], T_Result],
        visa: typing.Callable[[], T_Result],
    ) -> T_Result:
        if self is CardBrand.AMERICAN_EXPRESS:
            return american_express()
        if self is CardBrand.DISCOVER:
            return discover()
        if self is CardBrand.MASTERCARD:
            return mastercard()
        if self is CardBrand.VISA:
            return visa()
