{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Types.Discount where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified StripeAPI.Common
import StripeAPI.TypeAlias
import {-# SOURCE #-} StripeAPI.Types.Coupon
import {-# SOURCE #-} StripeAPI.Types.Customer
import {-# SOURCE #-} StripeAPI.Types.DeletedCustomer
import {-# SOURCE #-} StripeAPI.Types.PromotionCode
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data Discount = Discount
{
Discount -> Maybe Text
discountCheckoutSession :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Discount -> Coupon
discountCoupon :: Coupon,
Discount -> Maybe DiscountCustomer'Variants
discountCustomer :: (GHC.Maybe.Maybe DiscountCustomer'Variants),
Discount -> Maybe Int
discountEnd :: (GHC.Maybe.Maybe GHC.Types.Int),
Discount -> Text
discountId :: Data.Text.Internal.Text,
Discount -> Maybe Text
discountInvoice :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Discount -> Maybe Text
discountInvoiceItem :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
Discount -> Maybe DiscountPromotionCode'Variants
discountPromotionCode :: (GHC.Maybe.Maybe DiscountPromotionCode'Variants),
Discount -> Int
discountStart :: GHC.Types.Int,
Discount -> Maybe Text
discountSubscription :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> Discount -> ShowS
[Discount] -> ShowS
Discount -> String
(Int -> Discount -> ShowS)
-> (Discount -> String) -> ([Discount] -> ShowS) -> Show Discount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Discount] -> ShowS
$cshowList :: [Discount] -> ShowS
show :: Discount -> String
$cshow :: Discount -> String
showsPrec :: Int -> Discount -> ShowS
$cshowsPrec :: Int -> Discount -> ShowS
GHC.Show.Show,
Discount -> Discount -> Bool
(Discount -> Discount -> Bool)
-> (Discount -> Discount -> Bool) -> Eq Discount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Discount -> Discount -> Bool
$c/= :: Discount -> Discount -> Bool
== :: Discount -> Discount -> Bool
$c== :: Discount -> Discount -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON Discount where
toJSON :: Discount -> Value
toJSON Discount
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"checkout_session" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountCheckoutSession Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"coupon" Text -> Coupon -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Coupon
discountCoupon Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer" Text -> Maybe DiscountCustomer'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe DiscountCustomer'Variants
discountCustomer Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"end" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Int
discountEnd Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Text
discountId Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountInvoice Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice_item" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountInvoiceItem Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"promotion_code" Text -> Maybe DiscountPromotionCode'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe DiscountPromotionCode'Variants
discountPromotionCode Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"start" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Int
discountStart Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"subscription" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountSubscription Discount
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"discount" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: Discount -> Encoding
toEncoding Discount
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"checkout_session" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountCheckoutSession Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"coupon" Text -> Coupon -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Coupon
discountCoupon Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer" Text -> Maybe DiscountCustomer'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe DiscountCustomer'Variants
discountCustomer Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"end" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Int
discountEnd Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Text
discountId Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountInvoice Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice_item" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountInvoiceItem Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"promotion_code" Text -> Maybe DiscountPromotionCode'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe DiscountPromotionCode'Variants
discountPromotionCode Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"start" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Int
discountStart Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"subscription" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Discount -> Maybe Text
discountSubscription Discount
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"discount")))))))))))
instance Data.Aeson.Types.FromJSON.FromJSON Discount where
parseJSON :: Value -> Parser Discount
parseJSON = String -> (Object -> Parser Discount) -> Value -> Parser Discount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Discount" (\Object
obj -> ((((((((((Maybe Text
-> Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser
(Maybe Text
-> Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount
Discount Parser
(Maybe Text
-> Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser (Maybe Text)
-> Parser
(Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"checkout_session")) Parser
(Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser Coupon
-> Parser
(Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Coupon
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"coupon")) Parser
(Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser (Maybe DiscountCustomer'Variants)
-> Parser
(Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe DiscountCustomer'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"customer")) Parser
(Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser (Maybe Int)
-> Parser
(Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"end")) Parser
(Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser Text
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"id")) Parser
(Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"invoice")) Parser
(Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount)
-> Parser (Maybe Text)
-> Parser
(Maybe DiscountPromotionCode'Variants
-> Int -> Maybe Text -> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"invoice_item")) Parser
(Maybe DiscountPromotionCode'Variants
-> Int -> Maybe Text -> Discount)
-> Parser (Maybe DiscountPromotionCode'Variants)
-> Parser (Int -> Maybe Text -> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe DiscountPromotionCode'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"promotion_code")) Parser (Int -> Maybe Text -> Discount)
-> Parser Int -> Parser (Maybe Text -> Discount)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"start")) Parser (Maybe Text -> Discount)
-> Parser (Maybe Text) -> Parser Discount
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"subscription"))
mkDiscount ::
Coupon ->
Data.Text.Internal.Text ->
GHC.Types.Int ->
Discount
mkDiscount :: Coupon -> Text -> Int -> Discount
mkDiscount Coupon
discountCoupon Text
discountId Int
discountStart =
Discount :: Maybe Text
-> Coupon
-> Maybe DiscountCustomer'Variants
-> Maybe Int
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe DiscountPromotionCode'Variants
-> Int
-> Maybe Text
-> Discount
Discount
{ discountCheckoutSession :: Maybe Text
discountCheckoutSession = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
discountCoupon :: Coupon
discountCoupon = Coupon
discountCoupon,
discountCustomer :: Maybe DiscountCustomer'Variants
discountCustomer = Maybe DiscountCustomer'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
discountEnd :: Maybe Int
discountEnd = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
discountId :: Text
discountId = Text
discountId,
discountInvoice :: Maybe Text
discountInvoice = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
discountInvoiceItem :: Maybe Text
discountInvoiceItem = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
discountPromotionCode :: Maybe DiscountPromotionCode'Variants
discountPromotionCode = Maybe DiscountPromotionCode'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
discountStart :: Int
discountStart = Int
discountStart,
discountSubscription :: Maybe Text
discountSubscription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}
data DiscountCustomer'Variants
= DiscountCustomer'Text Data.Text.Internal.Text
| DiscountCustomer'Customer Customer
| DiscountCustomer'DeletedCustomer DeletedCustomer
deriving (Int -> DiscountCustomer'Variants -> ShowS
[DiscountCustomer'Variants] -> ShowS
DiscountCustomer'Variants -> String
(Int -> DiscountCustomer'Variants -> ShowS)
-> (DiscountCustomer'Variants -> String)
-> ([DiscountCustomer'Variants] -> ShowS)
-> Show DiscountCustomer'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscountCustomer'Variants] -> ShowS
$cshowList :: [DiscountCustomer'Variants] -> ShowS
show :: DiscountCustomer'Variants -> String
$cshow :: DiscountCustomer'Variants -> String
showsPrec :: Int -> DiscountCustomer'Variants -> ShowS
$cshowsPrec :: Int -> DiscountCustomer'Variants -> ShowS
GHC.Show.Show, DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool
(DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool)
-> (DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool)
-> Eq DiscountCustomer'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool
$c/= :: DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool
== :: DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool
$c== :: DiscountCustomer'Variants -> DiscountCustomer'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON DiscountCustomer'Variants where
toJSON :: DiscountCustomer'Variants -> Value
toJSON (DiscountCustomer'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (DiscountCustomer'Customer Customer
a) = Customer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Customer
a
toJSON (DiscountCustomer'DeletedCustomer DeletedCustomer
a) = DeletedCustomer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON DeletedCustomer
a
instance Data.Aeson.Types.FromJSON.FromJSON DiscountCustomer'Variants where
parseJSON :: Value -> Parser DiscountCustomer'Variants
parseJSON Value
val = case (Text -> DiscountCustomer'Variants
DiscountCustomer'Text (Text -> DiscountCustomer'Variants)
-> Result Text -> Result DiscountCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result DiscountCustomer'Variants
-> Result DiscountCustomer'Variants
-> Result DiscountCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Customer -> DiscountCustomer'Variants
DiscountCustomer'Customer (Customer -> DiscountCustomer'Variants)
-> Result Customer -> Result DiscountCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Customer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result DiscountCustomer'Variants
-> Result DiscountCustomer'Variants
-> Result DiscountCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((DeletedCustomer -> DiscountCustomer'Variants
DiscountCustomer'DeletedCustomer (DeletedCustomer -> DiscountCustomer'Variants)
-> Result DeletedCustomer -> Result DiscountCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result DeletedCustomer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result DiscountCustomer'Variants
-> Result DiscountCustomer'Variants
-> Result DiscountCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result DiscountCustomer'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")) of
Data.Aeson.Types.Internal.Success DiscountCustomer'Variants
a -> DiscountCustomer'Variants -> Parser DiscountCustomer'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure DiscountCustomer'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser DiscountCustomer'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data DiscountPromotionCode'Variants
= DiscountPromotionCode'Text Data.Text.Internal.Text
| DiscountPromotionCode'PromotionCode PromotionCode
deriving (Int -> DiscountPromotionCode'Variants -> ShowS
[DiscountPromotionCode'Variants] -> ShowS
DiscountPromotionCode'Variants -> String
(Int -> DiscountPromotionCode'Variants -> ShowS)
-> (DiscountPromotionCode'Variants -> String)
-> ([DiscountPromotionCode'Variants] -> ShowS)
-> Show DiscountPromotionCode'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscountPromotionCode'Variants] -> ShowS
$cshowList :: [DiscountPromotionCode'Variants] -> ShowS
show :: DiscountPromotionCode'Variants -> String
$cshow :: DiscountPromotionCode'Variants -> String
showsPrec :: Int -> DiscountPromotionCode'Variants -> ShowS
$cshowsPrec :: Int -> DiscountPromotionCode'Variants -> ShowS
GHC.Show.Show, DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool
(DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool)
-> (DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool)
-> Eq DiscountPromotionCode'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool
$c/= :: DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool
== :: DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool
$c== :: DiscountPromotionCode'Variants
-> DiscountPromotionCode'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON DiscountPromotionCode'Variants where
toJSON :: DiscountPromotionCode'Variants -> Value
toJSON (DiscountPromotionCode'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
toJSON (DiscountPromotionCode'PromotionCode PromotionCode
a) = PromotionCode -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON PromotionCode
a
instance Data.Aeson.Types.FromJSON.FromJSON DiscountPromotionCode'Variants where
parseJSON :: Value -> Parser DiscountPromotionCode'Variants
parseJSON Value
val = case (Text -> DiscountPromotionCode'Variants
DiscountPromotionCode'Text (Text -> DiscountPromotionCode'Variants)
-> Result Text -> Result DiscountPromotionCode'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result DiscountPromotionCode'Variants
-> Result DiscountPromotionCode'Variants
-> Result DiscountPromotionCode'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((PromotionCode -> DiscountPromotionCode'Variants
DiscountPromotionCode'PromotionCode (PromotionCode -> DiscountPromotionCode'Variants)
-> Result PromotionCode -> Result DiscountPromotionCode'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result PromotionCode
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result DiscountPromotionCode'Variants
-> Result DiscountPromotionCode'Variants
-> Result DiscountPromotionCode'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result DiscountPromotionCode'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
Data.Aeson.Types.Internal.Success DiscountPromotionCode'Variants
a -> DiscountPromotionCode'Variants
-> Parser DiscountPromotionCode'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure DiscountPromotionCode'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser DiscountPromotionCode'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a