{-# LANGUAGE MultiWayIf #-}
-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
{-# LANGUAGE OverloadedStrings #-}

-- | Contains the types generated from the schema CouponRedemptionMini
module RecurlyClient.Types.CouponRedemptionMini 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 {-# SOURCE #-} RecurlyClient.Types.CouponMini
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.CouponRedemptionMini@ in the specification.
data CouponRedemptionMini = CouponRedemptionMini
    { CouponRedemptionMini -> Maybe CouponMini
couponRedemptionMiniCoupon :: (GHC.Maybe.Maybe CouponMini)
    -- ^ coupon
    , CouponRedemptionMini -> Maybe JsonDateTime
couponRedemptionMiniCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at
    , CouponRedemptionMini -> Maybe Float
couponRedemptionMiniDiscounted :: (GHC.Maybe.Maybe GHC.Types.Float)
    -- ^ discounted: The amount that was discounted upon the application of the coupon, formatted with the currency.
    , CouponRedemptionMini -> Maybe Text
couponRedemptionMiniId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id
    , CouponRedemptionMini -> Maybe Text
couponRedemptionMiniObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object: Will always be \`coupon\`.
    , CouponRedemptionMini -> Maybe CouponRedemptionMiniState
couponRedemptionMiniState :: (GHC.Maybe.Maybe CouponRedemptionMiniState)
    -- ^ state
    }
    deriving
        ( Int -> CouponRedemptionMini -> ShowS
[CouponRedemptionMini] -> ShowS
CouponRedemptionMini -> String
(Int -> CouponRedemptionMini -> ShowS)
-> (CouponRedemptionMini -> String)
-> ([CouponRedemptionMini] -> ShowS)
-> Show CouponRedemptionMini
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponRedemptionMini -> ShowS
showsPrec :: Int -> CouponRedemptionMini -> ShowS
$cshow :: CouponRedemptionMini -> String
show :: CouponRedemptionMini -> String
$cshowList :: [CouponRedemptionMini] -> ShowS
showList :: [CouponRedemptionMini] -> ShowS
GHC.Show.Show
        , CouponRedemptionMini -> CouponRedemptionMini -> Bool
(CouponRedemptionMini -> CouponRedemptionMini -> Bool)
-> (CouponRedemptionMini -> CouponRedemptionMini -> Bool)
-> Eq CouponRedemptionMini
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponRedemptionMini -> CouponRedemptionMini -> Bool
== :: CouponRedemptionMini -> CouponRedemptionMini -> Bool
$c/= :: CouponRedemptionMini -> CouponRedemptionMini -> Bool
/= :: CouponRedemptionMini -> CouponRedemptionMini -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON CouponRedemptionMini where
    toJSON :: CouponRedemptionMini -> Value
toJSON CouponRedemptionMini
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (CouponMini -> [Pair]) -> Maybe CouponMini -> [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]) -> (CouponMini -> Pair) -> CouponMini -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"coupon" Key -> CouponMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponRedemptionMini -> Maybe CouponMini
couponRedemptionMiniCoupon CouponRedemptionMini
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..=)) (CouponRedemptionMini -> Maybe JsonDateTime
couponRedemptionMiniCreated_at CouponRedemptionMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Float -> [Pair]) -> Maybe Float -> [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]) -> (Float -> Pair) -> Float -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"discounted" Key -> Float -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponRedemptionMini -> Maybe Float
couponRedemptionMiniDiscounted CouponRedemptionMini
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..=)) (CouponRedemptionMini -> Maybe Text
couponRedemptionMiniId CouponRedemptionMini
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..=)) (CouponRedemptionMini -> Maybe Text
couponRedemptionMiniObject CouponRedemptionMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CouponRedemptionMiniState -> [Pair])
-> Maybe CouponRedemptionMiniState
-> [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])
-> (CouponRedemptionMiniState -> Pair)
-> CouponRedemptionMiniState
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> CouponRedemptionMiniState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CouponRedemptionMini -> Maybe CouponRedemptionMiniState
couponRedemptionMiniState CouponRedemptionMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: CouponRedemptionMini -> Encoding
toEncoding CouponRedemptionMini
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]
-> (CouponMini -> [Series]) -> Maybe CouponMini -> [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])
-> (CouponMini -> Series) -> CouponMini -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"coupon" Key -> CouponMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponRedemptionMini -> Maybe CouponMini
couponRedemptionMiniCoupon CouponRedemptionMini
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..=)) (CouponRedemptionMini -> Maybe JsonDateTime
couponRedemptionMiniCreated_at CouponRedemptionMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Float -> [Series]) -> Maybe Float -> [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]) -> (Float -> Series) -> Float -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"discounted" Key -> Float -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponRedemptionMini -> Maybe Float
couponRedemptionMiniDiscounted CouponRedemptionMini
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..=)) (CouponRedemptionMini -> Maybe Text
couponRedemptionMiniId CouponRedemptionMini
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..=)) (CouponRedemptionMini -> Maybe Text
couponRedemptionMiniObject CouponRedemptionMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CouponRedemptionMiniState -> [Series])
-> Maybe CouponRedemptionMiniState
-> [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])
-> (CouponRedemptionMiniState -> Series)
-> CouponRedemptionMiniState
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> CouponRedemptionMiniState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CouponRedemptionMini -> Maybe CouponRedemptionMiniState
couponRedemptionMiniState CouponRedemptionMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON CouponRedemptionMini where
    parseJSON :: Value -> Parser CouponRedemptionMini
parseJSON = String
-> (Object -> Parser CouponRedemptionMini)
-> Value
-> Parser CouponRedemptionMini
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"CouponRedemptionMini" (\Object
obj -> ((((((Maybe CouponMini
 -> Maybe JsonDateTime
 -> Maybe Float
 -> Maybe Text
 -> Maybe Text
 -> Maybe CouponRedemptionMiniState
 -> CouponRedemptionMini)
-> Parser
     (Maybe CouponMini
      -> Maybe JsonDateTime
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe CouponRedemptionMiniState
      -> CouponRedemptionMini)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe CouponMini
-> Maybe JsonDateTime
-> Maybe Float
-> Maybe Text
-> Maybe Text
-> Maybe CouponRedemptionMiniState
-> CouponRedemptionMini
CouponRedemptionMini Parser
  (Maybe CouponMini
   -> Maybe JsonDateTime
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe CouponRedemptionMiniState
   -> CouponRedemptionMini)
-> Parser (Maybe CouponMini)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe CouponRedemptionMiniState
      -> CouponRedemptionMini)
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 CouponMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"coupon")) Parser
  (Maybe JsonDateTime
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe CouponRedemptionMiniState
   -> CouponRedemptionMini)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe CouponRedemptionMiniState
      -> CouponRedemptionMini)
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 Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe CouponRedemptionMiniState
   -> CouponRedemptionMini)
-> Parser (Maybe Float)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe CouponRedemptionMiniState
      -> CouponRedemptionMini)
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 Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"discounted")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe CouponRedemptionMiniState
   -> CouponRedemptionMini)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe CouponRedemptionMiniState -> CouponRedemptionMini)
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 CouponRedemptionMiniState -> CouponRedemptionMini)
-> Parser (Maybe Text)
-> Parser (Maybe CouponRedemptionMiniState -> CouponRedemptionMini)
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 CouponRedemptionMiniState -> CouponRedemptionMini)
-> Parser (Maybe CouponRedemptionMiniState)
-> Parser CouponRedemptionMini
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 CouponRedemptionMiniState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"state"))

-- | Create a new 'CouponRedemptionMini' with all required fields.
mkCouponRedemptionMini :: CouponRedemptionMini
mkCouponRedemptionMini :: CouponRedemptionMini
mkCouponRedemptionMini =
    CouponRedemptionMini
        { couponRedemptionMiniCoupon :: Maybe CouponMini
couponRedemptionMiniCoupon = Maybe CouponMini
forall a. Maybe a
GHC.Maybe.Nothing
        , couponRedemptionMiniCreated_at :: Maybe JsonDateTime
couponRedemptionMiniCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , couponRedemptionMiniDiscounted :: Maybe Float
couponRedemptionMiniDiscounted = Maybe Float
forall a. Maybe a
GHC.Maybe.Nothing
        , couponRedemptionMiniId :: Maybe Text
couponRedemptionMiniId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , couponRedemptionMiniObject :: Maybe Text
couponRedemptionMiniObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , couponRedemptionMiniState :: Maybe CouponRedemptionMiniState
couponRedemptionMiniState = Maybe CouponRedemptionMiniState
forall a. Maybe a
GHC.Maybe.Nothing
        }

-- | Defines the enum schema located at @components.schemas.CouponRedemptionMini.properties.state@ in the specification.
data CouponRedemptionMiniState
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      CouponRedemptionMiniStateOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      CouponRedemptionMiniStateTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"active"@
      CouponRedemptionMiniStateEnumActive
    | -- | Represents the JSON value @"inactive"@
      CouponRedemptionMiniStateEnumInactive
    deriving (Int -> CouponRedemptionMiniState -> ShowS
[CouponRedemptionMiniState] -> ShowS
CouponRedemptionMiniState -> String
(Int -> CouponRedemptionMiniState -> ShowS)
-> (CouponRedemptionMiniState -> String)
-> ([CouponRedemptionMiniState] -> ShowS)
-> Show CouponRedemptionMiniState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CouponRedemptionMiniState -> ShowS
showsPrec :: Int -> CouponRedemptionMiniState -> ShowS
$cshow :: CouponRedemptionMiniState -> String
show :: CouponRedemptionMiniState -> String
$cshowList :: [CouponRedemptionMiniState] -> ShowS
showList :: [CouponRedemptionMiniState] -> ShowS
GHC.Show.Show, CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool
(CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool)
-> (CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool)
-> Eq CouponRedemptionMiniState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool
== :: CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool
$c/= :: CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool
/= :: CouponRedemptionMiniState -> CouponRedemptionMiniState -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CouponRedemptionMiniState where
    toJSON :: CouponRedemptionMiniState -> Value
toJSON (CouponRedemptionMiniStateOther Value
val) = Value
val
    toJSON (CouponRedemptionMiniStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (CouponRedemptionMiniState
CouponRedemptionMiniStateEnumActive) = Value
"active"
    toJSON (CouponRedemptionMiniState
CouponRedemptionMiniStateEnumInactive) = Value
"inactive"
instance Data.Aeson.Types.FromJSON.FromJSON CouponRedemptionMiniState where
    parseJSON :: Value -> Parser CouponRedemptionMiniState
parseJSON Value
val =
        CouponRedemptionMiniState -> Parser CouponRedemptionMiniState
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
"active" -> CouponRedemptionMiniState
CouponRedemptionMiniStateEnumActive
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inactive" -> CouponRedemptionMiniState
CouponRedemptionMiniStateEnumInactive
                | Bool
GHC.Base.otherwise -> Value -> CouponRedemptionMiniState
CouponRedemptionMiniStateOther Value
val
            )