{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.UniqueCouponCode 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
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as 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 RecurlyClient.Common
import RecurlyClient.TypeAlias
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data UniqueCouponCode = UniqueCouponCode
{ UniqueCouponCode -> Maybe Text
uniqueCouponCodeBulk_coupon_code :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, UniqueCouponCode -> Maybe Text
uniqueCouponCodeBulk_coupon_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, UniqueCouponCode -> Maybe Text
uniqueCouponCodeCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeExpired_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, UniqueCouponCode -> Maybe Text
uniqueCouponCodeId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, UniqueCouponCode -> Maybe Text
uniqueCouponCodeObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeRedeemed_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, UniqueCouponCode -> Maybe UniqueCouponCodeState
uniqueCouponCodeState :: (GHC.Maybe.Maybe UniqueCouponCodeState)
, UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
}
deriving
( Int -> UniqueCouponCode -> ShowS
[UniqueCouponCode] -> ShowS
UniqueCouponCode -> String
(Int -> UniqueCouponCode -> ShowS)
-> (UniqueCouponCode -> String)
-> ([UniqueCouponCode] -> ShowS)
-> Show UniqueCouponCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UniqueCouponCode -> ShowS
showsPrec :: Int -> UniqueCouponCode -> ShowS
$cshow :: UniqueCouponCode -> String
show :: UniqueCouponCode -> String
$cshowList :: [UniqueCouponCode] -> ShowS
showList :: [UniqueCouponCode] -> ShowS
GHC.Show.Show
, UniqueCouponCode -> UniqueCouponCode -> Bool
(UniqueCouponCode -> UniqueCouponCode -> Bool)
-> (UniqueCouponCode -> UniqueCouponCode -> Bool)
-> Eq UniqueCouponCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UniqueCouponCode -> UniqueCouponCode -> Bool
== :: UniqueCouponCode -> UniqueCouponCode -> Bool
$c/= :: UniqueCouponCode -> UniqueCouponCode -> Bool
/= :: UniqueCouponCode -> UniqueCouponCode -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON UniqueCouponCode where
toJSON :: UniqueCouponCode -> Value
toJSON UniqueCouponCode
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeBulk_coupon_code UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeBulk_coupon_id UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeCode UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeCreated_at UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeExpired_at UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeId UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeObject UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redeemed_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeRedeemed_at UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (UniqueCouponCodeState -> [Pair])
-> Maybe UniqueCouponCodeState
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (UniqueCouponCodeState -> Pair)
-> UniqueCouponCodeState
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> UniqueCouponCodeState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe UniqueCouponCodeState
uniqueCouponCodeState UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeUpdated_at UniqueCouponCode
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: UniqueCouponCode -> Encoding
toEncoding UniqueCouponCode
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeBulk_coupon_code UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"bulk_coupon_id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeBulk_coupon_id UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeCode UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeCreated_at UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeExpired_at UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeId UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe Text
uniqueCouponCodeObject UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"redeemed_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeRedeemed_at UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (UniqueCouponCodeState -> [Series])
-> Maybe UniqueCouponCodeState
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (UniqueCouponCodeState -> Series)
-> UniqueCouponCodeState
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> UniqueCouponCodeState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe UniqueCouponCodeState
uniqueCouponCodeState UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (UniqueCouponCode -> Maybe JsonDateTime
uniqueCouponCodeUpdated_at UniqueCouponCode
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON UniqueCouponCode where
parseJSON :: Value -> Parser UniqueCouponCode
parseJSON = String
-> (Object -> Parser UniqueCouponCode)
-> Value
-> Parser UniqueCouponCode
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"UniqueCouponCode" (\Object
obj -> ((((((((((Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode
UniqueCouponCode Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"bulk_coupon_code")) Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"bulk_coupon_id")) Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe Text)
-> Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"code")) Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"expired_at")) Parser
(Maybe Text
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
(Maybe Text
-> Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe Text)
-> Parser
(Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser
(Maybe JsonDateTime
-> Maybe UniqueCouponCodeState
-> Maybe JsonDateTime
-> UniqueCouponCode)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe UniqueCouponCodeState
-> Maybe JsonDateTime -> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"redeemed_at")) Parser
(Maybe UniqueCouponCodeState
-> Maybe JsonDateTime -> UniqueCouponCode)
-> Parser (Maybe UniqueCouponCodeState)
-> Parser (Maybe JsonDateTime -> UniqueCouponCode)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe UniqueCouponCodeState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"state")) Parser (Maybe JsonDateTime -> UniqueCouponCode)
-> Parser (Maybe JsonDateTime) -> Parser UniqueCouponCode
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at"))
mkUniqueCouponCode :: UniqueCouponCode
mkUniqueCouponCode :: UniqueCouponCode
mkUniqueCouponCode =
UniqueCouponCode
{ uniqueCouponCodeBulk_coupon_code :: Maybe Text
uniqueCouponCodeBulk_coupon_code = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeBulk_coupon_id :: Maybe Text
uniqueCouponCodeBulk_coupon_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeCode :: Maybe Text
uniqueCouponCodeCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeCreated_at :: Maybe JsonDateTime
uniqueCouponCodeCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeExpired_at :: Maybe JsonDateTime
uniqueCouponCodeExpired_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeId :: Maybe Text
uniqueCouponCodeId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeObject :: Maybe Text
uniqueCouponCodeObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeRedeemed_at :: Maybe JsonDateTime
uniqueCouponCodeRedeemed_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeState :: Maybe UniqueCouponCodeState
uniqueCouponCodeState = Maybe UniqueCouponCodeState
forall a. Maybe a
GHC.Maybe.Nothing
, uniqueCouponCodeUpdated_at :: Maybe JsonDateTime
uniqueCouponCodeUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
}
data UniqueCouponCodeState
=
UniqueCouponCodeStateOther Data.Aeson.Types.Internal.Value
|
UniqueCouponCodeStateTyped Data.Text.Internal.Text
|
UniqueCouponCodeStateEnumExpired
|
UniqueCouponCodeStateEnumInactive
|
UniqueCouponCodeStateEnumMaxed_out
|
UniqueCouponCodeStateEnumRedeemable
deriving (Int -> UniqueCouponCodeState -> ShowS
[UniqueCouponCodeState] -> ShowS
UniqueCouponCodeState -> String
(Int -> UniqueCouponCodeState -> ShowS)
-> (UniqueCouponCodeState -> String)
-> ([UniqueCouponCodeState] -> ShowS)
-> Show UniqueCouponCodeState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UniqueCouponCodeState -> ShowS
showsPrec :: Int -> UniqueCouponCodeState -> ShowS
$cshow :: UniqueCouponCodeState -> String
show :: UniqueCouponCodeState -> String
$cshowList :: [UniqueCouponCodeState] -> ShowS
showList :: [UniqueCouponCodeState] -> ShowS
GHC.Show.Show, UniqueCouponCodeState -> UniqueCouponCodeState -> Bool
(UniqueCouponCodeState -> UniqueCouponCodeState -> Bool)
-> (UniqueCouponCodeState -> UniqueCouponCodeState -> Bool)
-> Eq UniqueCouponCodeState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UniqueCouponCodeState -> UniqueCouponCodeState -> Bool
== :: UniqueCouponCodeState -> UniqueCouponCodeState -> Bool
$c/= :: UniqueCouponCodeState -> UniqueCouponCodeState -> Bool
/= :: UniqueCouponCodeState -> UniqueCouponCodeState -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON UniqueCouponCodeState where
toJSON :: UniqueCouponCodeState -> Value
toJSON (UniqueCouponCodeStateOther Value
val) = Value
val
toJSON (UniqueCouponCodeStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (UniqueCouponCodeState
UniqueCouponCodeStateEnumExpired) = Value
"expired"
toJSON (UniqueCouponCodeState
UniqueCouponCodeStateEnumInactive) = Value
"inactive"
toJSON (UniqueCouponCodeState
UniqueCouponCodeStateEnumMaxed_out) = Value
"maxed_out"
toJSON (UniqueCouponCodeState
UniqueCouponCodeStateEnumRedeemable) = Value
"redeemable"
instance Data.Aeson.Types.FromJSON.FromJSON UniqueCouponCodeState where
parseJSON :: Value -> Parser UniqueCouponCodeState
parseJSON Value
val =
UniqueCouponCodeState -> Parser UniqueCouponCodeState
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
( if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"expired" -> UniqueCouponCodeState
UniqueCouponCodeStateEnumExpired
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inactive" -> UniqueCouponCodeState
UniqueCouponCodeStateEnumInactive
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"maxed_out" -> UniqueCouponCodeState
UniqueCouponCodeStateEnumMaxed_out
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"redeemable" -> UniqueCouponCodeState
UniqueCouponCodeStateEnumRedeemable
| Bool
GHC.Base.otherwise -> Value -> UniqueCouponCodeState
UniqueCouponCodeStateOther Value
val
)