import graphene

from api.types import FailureNode, Success


class InvalidCoupon(graphene.ObjectType):
    class Meta:
        interfaces = (FailureNode,)


RedeemCouponSuccess = Success(message="Coupon successfully redeemed.")
InvalidCouponFailure = InvalidCoupon(reason="Invalid coupon provided.")


class RedeemCouponResult(graphene.Union):
    class Meta:
        types = (
            Success,
            InvalidCoupon,
        )
