{-# 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 ExternalSubscriptionCreate
module RecurlyClient.Types.ExternalSubscriptionCreate 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.AccountExternalSubscription
import {-# SOURCE #-} RecurlyClient.Types.ExternalProductReferenceCreate
import {-# SOURCE #-} RecurlyClient.Types.ExternalSubscriptionBase
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.ExternalSubscriptionCreate.allOf@ in the specification.
data ExternalSubscriptionCreate = ExternalSubscriptionCreate
    { ExternalSubscriptionCreate -> Maybe AccountExternalSubscription
externalSubscriptionCreateAccount :: (GHC.Maybe.Maybe AccountExternalSubscription)
    -- ^ account
    , ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateActivated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ activated_at: When the external subscription was activated in the external platform.
    , ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateApp_identifier :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ app_identifier: Identifier of the app that generated the external subscription.
    , ExternalSubscriptionCreate -> Maybe Bool
externalSubscriptionCreateAuto_renew :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ auto_renew: An indication of whether or not the external subscription will auto-renew at the expiration date.
    , ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateExpires_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ expires_at: When the external subscription expires in the external platform.
    , ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateExternal_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ external_id: Id of the subscription in the external system, i.e. Apple App Store or Google Play Store.
    , ExternalSubscriptionCreate -> Maybe ExternalProductReferenceCreate
externalSubscriptionCreateExternal_product_reference :: (GHC.Maybe.Maybe ExternalProductReferenceCreate)
    -- ^ external_product_reference
    , ExternalSubscriptionCreate -> Maybe Bool
externalSubscriptionCreateImported :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ imported: An indication of whether or not the external subscription was being created by a historical data import.
    , ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateLast_purchased :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ last_purchased: When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade\/downgrade.
    , ExternalSubscriptionCreate -> Maybe Int
externalSubscriptionCreateQuantity :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ quantity: An indication of the quantity of a subscribed item\'s quantity.
    --
    -- Constraints:
    --
    -- * Minimum  of 0.0
    , ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateState :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ state: External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused.
    , ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateTrial_ends_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ trial_ends_at: When the external subscription trial period ends in the external platform.
    , ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateTrial_started_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ trial_started_at: When the external subscription trial period started in the external platform.
    }
    deriving
        ( Int -> ExternalSubscriptionCreate -> ShowS
[ExternalSubscriptionCreate] -> ShowS
ExternalSubscriptionCreate -> String
(Int -> ExternalSubscriptionCreate -> ShowS)
-> (ExternalSubscriptionCreate -> String)
-> ([ExternalSubscriptionCreate] -> ShowS)
-> Show ExternalSubscriptionCreate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExternalSubscriptionCreate -> ShowS
showsPrec :: Int -> ExternalSubscriptionCreate -> ShowS
$cshow :: ExternalSubscriptionCreate -> String
show :: ExternalSubscriptionCreate -> String
$cshowList :: [ExternalSubscriptionCreate] -> ShowS
showList :: [ExternalSubscriptionCreate] -> ShowS
GHC.Show.Show
        , ExternalSubscriptionCreate -> ExternalSubscriptionCreate -> Bool
(ExternalSubscriptionCreate -> ExternalSubscriptionCreate -> Bool)
-> (ExternalSubscriptionCreate
    -> ExternalSubscriptionCreate -> Bool)
-> Eq ExternalSubscriptionCreate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalSubscriptionCreate -> ExternalSubscriptionCreate -> Bool
== :: ExternalSubscriptionCreate -> ExternalSubscriptionCreate -> Bool
$c/= :: ExternalSubscriptionCreate -> ExternalSubscriptionCreate -> Bool
/= :: ExternalSubscriptionCreate -> ExternalSubscriptionCreate -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON ExternalSubscriptionCreate where
    toJSON :: ExternalSubscriptionCreate -> Value
toJSON ExternalSubscriptionCreate
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair]
-> (AccountExternalSubscription -> [Pair])
-> Maybe AccountExternalSubscription
-> [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])
-> (AccountExternalSubscription -> Pair)
-> AccountExternalSubscription
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account" Key -> AccountExternalSubscription -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe AccountExternalSubscription
externalSubscriptionCreateAccount ExternalSubscriptionCreate
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
"activated_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateActivated_at ExternalSubscriptionCreate
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
"app_identifier" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateApp_identifier ExternalSubscriptionCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [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]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"auto_renew" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Bool
externalSubscriptionCreateAuto_renew ExternalSubscriptionCreate
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
"expires_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateExpires_at ExternalSubscriptionCreate
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
"external_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..=)) (ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateExternal_id ExternalSubscriptionCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (ExternalProductReferenceCreate -> [Pair])
-> Maybe ExternalProductReferenceCreate
-> [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])
-> (ExternalProductReferenceCreate -> Pair)
-> ExternalProductReferenceCreate
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_reference" Key -> ExternalProductReferenceCreate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe ExternalProductReferenceCreate
externalSubscriptionCreateExternal_product_reference ExternalSubscriptionCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [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]) -> (Bool -> Pair) -> Bool -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"imported" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Bool
externalSubscriptionCreateImported ExternalSubscriptionCreate
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
"last_purchased" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateLast_purchased ExternalSubscriptionCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Int -> [Pair]) -> Maybe Int -> [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]) -> (Int -> Pair) -> Int -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"quantity" Key -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Int
externalSubscriptionCreateQuantity ExternalSubscriptionCreate
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
"state" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateState ExternalSubscriptionCreate
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
"trial_ends_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateTrial_ends_at ExternalSubscriptionCreate
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
"trial_started_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateTrial_started_at ExternalSubscriptionCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: ExternalSubscriptionCreate -> Encoding
toEncoding ExternalSubscriptionCreate
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]
-> (AccountExternalSubscription -> [Series])
-> Maybe AccountExternalSubscription
-> [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])
-> (AccountExternalSubscription -> Series)
-> AccountExternalSubscription
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"account" Key -> AccountExternalSubscription -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe AccountExternalSubscription
externalSubscriptionCreateAccount ExternalSubscriptionCreate
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
"activated_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateActivated_at ExternalSubscriptionCreate
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
"app_identifier" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateApp_identifier ExternalSubscriptionCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [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]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"auto_renew" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Bool
externalSubscriptionCreateAuto_renew ExternalSubscriptionCreate
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
"expires_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateExpires_at ExternalSubscriptionCreate
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
"external_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..=)) (ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateExternal_id ExternalSubscriptionCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (ExternalProductReferenceCreate -> [Series])
-> Maybe ExternalProductReferenceCreate
-> [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])
-> (ExternalProductReferenceCreate -> Series)
-> ExternalProductReferenceCreate
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_reference" Key -> ExternalProductReferenceCreate -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe ExternalProductReferenceCreate
externalSubscriptionCreateExternal_product_reference ExternalSubscriptionCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Bool -> [Series]) -> Maybe Bool -> [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]) -> (Bool -> Series) -> Bool -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"imported" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Bool
externalSubscriptionCreateImported ExternalSubscriptionCreate
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
"last_purchased" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateLast_purchased ExternalSubscriptionCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Int -> [Series]) -> Maybe Int -> [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]) -> (Int -> Series) -> Int -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"quantity" Key -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Int
externalSubscriptionCreateQuantity ExternalSubscriptionCreate
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
"state" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalSubscriptionCreate -> Maybe Text
externalSubscriptionCreateState ExternalSubscriptionCreate
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
"trial_ends_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateTrial_ends_at ExternalSubscriptionCreate
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
"trial_started_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..=)) (ExternalSubscriptionCreate -> Maybe JsonDateTime
externalSubscriptionCreateTrial_started_at ExternalSubscriptionCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON ExternalSubscriptionCreate where
    parseJSON :: Value -> Parser ExternalSubscriptionCreate
parseJSON = String
-> (Object -> Parser ExternalSubscriptionCreate)
-> Value
-> Parser ExternalSubscriptionCreate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ExternalSubscriptionCreate" (\Object
obj -> (((((((((((((Maybe AccountExternalSubscription
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe Bool
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe ExternalProductReferenceCreate
 -> Maybe Bool
 -> Maybe JsonDateTime
 -> Maybe Int
 -> Maybe Text
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> ExternalSubscriptionCreate)
-> Parser
     (Maybe AccountExternalSubscription
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe AccountExternalSubscription
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe ExternalProductReferenceCreate
-> Maybe Bool
-> Maybe JsonDateTime
-> Maybe Int
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> ExternalSubscriptionCreate
ExternalSubscriptionCreate Parser
  (Maybe AccountExternalSubscription
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe AccountExternalSubscription)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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 AccountExternalSubscription)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"account")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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
"activated_at")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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
"app_identifier")) Parser
  (Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe Bool)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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 Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"auto_renew")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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
"expires_at")) Parser
  (Maybe Text
   -> Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe Text)
-> Parser
     (Maybe ExternalProductReferenceCreate
      -> Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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
"external_id")) Parser
  (Maybe ExternalProductReferenceCreate
   -> Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe ExternalProductReferenceCreate)
-> Parser
     (Maybe Bool
      -> Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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 ExternalProductReferenceCreate)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"external_product_reference")) Parser
  (Maybe Bool
   -> Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe Bool)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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 Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"imported")) Parser
  (Maybe JsonDateTime
   -> Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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
"last_purchased")) Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> ExternalSubscriptionCreate)
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 Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"quantity")) Parser
  (Maybe Text
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> ExternalSubscriptionCreate)
-> Parser (Maybe Text)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime -> ExternalSubscriptionCreate)
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
"state")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime -> ExternalSubscriptionCreate)
-> Parser (Maybe JsonDateTime)
-> Parser (Maybe JsonDateTime -> ExternalSubscriptionCreate)
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
"trial_ends_at")) Parser (Maybe JsonDateTime -> ExternalSubscriptionCreate)
-> Parser (Maybe JsonDateTime) -> Parser ExternalSubscriptionCreate
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
"trial_started_at"))

-- | Create a new 'ExternalSubscriptionCreate' with all required fields.
mkExternalSubscriptionCreate :: ExternalSubscriptionCreate
mkExternalSubscriptionCreate :: ExternalSubscriptionCreate
mkExternalSubscriptionCreate =
    ExternalSubscriptionCreate
        { externalSubscriptionCreateAccount :: Maybe AccountExternalSubscription
externalSubscriptionCreateAccount = Maybe AccountExternalSubscription
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateActivated_at :: Maybe JsonDateTime
externalSubscriptionCreateActivated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateApp_identifier :: Maybe Text
externalSubscriptionCreateApp_identifier = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateAuto_renew :: Maybe Bool
externalSubscriptionCreateAuto_renew = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateExpires_at :: Maybe JsonDateTime
externalSubscriptionCreateExpires_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateExternal_id :: Maybe Text
externalSubscriptionCreateExternal_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateExternal_product_reference :: Maybe ExternalProductReferenceCreate
externalSubscriptionCreateExternal_product_reference = Maybe ExternalProductReferenceCreate
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateImported :: Maybe Bool
externalSubscriptionCreateImported = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateLast_purchased :: Maybe JsonDateTime
externalSubscriptionCreateLast_purchased = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateQuantity :: Maybe Int
externalSubscriptionCreateQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateState :: Maybe Text
externalSubscriptionCreateState = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateTrial_ends_at :: Maybe JsonDateTime
externalSubscriptionCreateTrial_ends_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalSubscriptionCreateTrial_started_at :: Maybe JsonDateTime
externalSubscriptionCreateTrial_started_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        }