"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .alreadyactivesubscriptionerror import AlreadyActiveSubscriptionErrorData
from .notopencheckout import NotOpenCheckoutData
from polar_sdk import utils
from typing import Union
from typing_extensions import TypeAliasType


CheckoutForbiddenErrorUnion = TypeAliasType(
    "CheckoutForbiddenErrorUnion",
    Union[AlreadyActiveSubscriptionErrorData, NotOpenCheckoutData],
)


class CheckoutForbiddenError(Exception):
    data: CheckoutForbiddenErrorUnion

    def __init__(self, data: CheckoutForbiddenErrorUnion):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(self.data, CheckoutForbiddenErrorUnion)
