{-# 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 SubscriptionChange
module RecurlyClient.Types.SubscriptionChange 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.BusinessEntityMini
import {-# SOURCE #-} RecurlyClient.Types.InvoiceCollection
import {-# SOURCE #-} RecurlyClient.Types.PlanMini
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionAddOn
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionChangeBillingInfo
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionRampIntervalResponse
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionShipping
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.SubscriptionChange@ in the specification.
data SubscriptionChange = SubscriptionChange
    { SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeActivate_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ activate_at
    , SubscriptionChange -> Maybe Bool
subscriptionChangeActivated :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ activated: Returns \`true\` if the subscription change is activated.
    , SubscriptionChange -> Maybe [SubscriptionAddOn]
subscriptionChangeAdd_ons :: (GHC.Maybe.Maybe [SubscriptionAddOn])
    -- ^ add_ons: These add-ons will be used when the subscription renews.
    , SubscriptionChange -> Maybe SubscriptionChangeBillingInfo
subscriptionChangeBilling_info :: (GHC.Maybe.Maybe SubscriptionChangeBillingInfo)
    -- ^ billing_info: Accept nested attributes for three_d_secure_action_result_token_id
    , SubscriptionChange -> Maybe BusinessEntityMini
subscriptionChangeBusiness_entity :: (GHC.Maybe.Maybe BusinessEntityMini)
    -- ^ business_entity: Business entity details
    , SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at
    , SubscriptionChange -> Maybe CustomFields
subscriptionChangeCustom_fields :: (GHC.Maybe.Maybe CustomFields)
    -- ^ custom_fields: The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value.
    , SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeDeleted_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ deleted_at
    , SubscriptionChange -> Maybe Text
subscriptionChangeId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id: The ID of the Subscription Change.
    , SubscriptionChange -> Maybe InvoiceCollection
subscriptionChangeInvoice_collection :: (GHC.Maybe.Maybe InvoiceCollection)
    -- ^ invoice_collection
    , SubscriptionChange -> Maybe Text
subscriptionChangeObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , SubscriptionChange -> Maybe PlanMini
subscriptionChangePlan :: (GHC.Maybe.Maybe PlanMini)
    -- ^ plan: Just the important parts.
    , SubscriptionChange -> Maybe Int
subscriptionChangeQuantity :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ quantity
    , SubscriptionChange -> Maybe [SubscriptionRampIntervalResponse]
subscriptionChangeRamp_intervals :: (GHC.Maybe.Maybe [SubscriptionRampIntervalResponse])
    -- ^ ramp_intervals: The ramp intervals representing the pricing schedule for the subscription.
    , SubscriptionChange -> Maybe SubscriptionChangeRevenue_schedule_type
subscriptionChangeRevenue_schedule_type :: (GHC.Maybe.Maybe SubscriptionChangeRevenue_schedule_type)
    -- ^ revenue_schedule_type
    , SubscriptionChange -> Maybe SubscriptionShipping
subscriptionChangeShipping :: (GHC.Maybe.Maybe SubscriptionShipping)
    -- ^ shipping
    , SubscriptionChange -> Maybe Text
subscriptionChangeSubscription_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ subscription_id: The ID of the subscription that is going to be changed.
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , SubscriptionChange -> Maybe Bool
subscriptionChangeTax_inclusive :: (GHC.Maybe.Maybe GHC.Types.Bool)
    -- ^ tax_inclusive: This field is deprecated. Please do not use it.
    , SubscriptionChange -> Maybe Float
subscriptionChangeUnit_amount :: (GHC.Maybe.Maybe GHC.Types.Float)
    -- ^ unit_amount
    , SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at
    }
    deriving
        ( Int -> SubscriptionChange -> ShowS
[SubscriptionChange] -> ShowS
SubscriptionChange -> String
(Int -> SubscriptionChange -> ShowS)
-> (SubscriptionChange -> String)
-> ([SubscriptionChange] -> ShowS)
-> Show SubscriptionChange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionChange -> ShowS
showsPrec :: Int -> SubscriptionChange -> ShowS
$cshow :: SubscriptionChange -> String
show :: SubscriptionChange -> String
$cshowList :: [SubscriptionChange] -> ShowS
showList :: [SubscriptionChange] -> ShowS
GHC.Show.Show
        , SubscriptionChange -> SubscriptionChange -> Bool
(SubscriptionChange -> SubscriptionChange -> Bool)
-> (SubscriptionChange -> SubscriptionChange -> Bool)
-> Eq SubscriptionChange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionChange -> SubscriptionChange -> Bool
== :: SubscriptionChange -> SubscriptionChange -> Bool
$c/= :: SubscriptionChange -> SubscriptionChange -> Bool
/= :: SubscriptionChange -> SubscriptionChange -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionChange where
    toJSON :: SubscriptionChange -> Value
toJSON SubscriptionChange
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([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
"activate_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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeActivate_at SubscriptionChange
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
"activated" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe Bool
subscriptionChangeActivated SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> ([SubscriptionAddOn] -> [Pair])
-> Maybe [SubscriptionAddOn]
-> [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])
-> ([SubscriptionAddOn] -> Pair) -> [SubscriptionAddOn] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_ons" Key -> [SubscriptionAddOn] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe [SubscriptionAddOn]
subscriptionChangeAdd_ons SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionChangeBillingInfo -> [Pair])
-> Maybe SubscriptionChangeBillingInfo
-> [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])
-> (SubscriptionChangeBillingInfo -> Pair)
-> SubscriptionChangeBillingInfo
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"billing_info" Key -> SubscriptionChangeBillingInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe SubscriptionChangeBillingInfo
subscriptionChangeBilling_info SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (BusinessEntityMini -> [Pair])
-> Maybe BusinessEntityMini
-> [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])
-> (BusinessEntityMini -> Pair) -> BusinessEntityMini -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"business_entity" Key -> BusinessEntityMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe BusinessEntityMini
subscriptionChangeBusiness_entity SubscriptionChange
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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeCreated_at SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (CustomFields -> [Pair]) -> Maybe CustomFields -> [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])
-> (CustomFields -> Pair) -> CustomFields -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"custom_fields" Key -> CustomFields -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe CustomFields
subscriptionChangeCustom_fields SubscriptionChange
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
"deleted_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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeDeleted_at SubscriptionChange
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..=)) (SubscriptionChange -> Maybe Text
subscriptionChangeId SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (InvoiceCollection -> [Pair])
-> Maybe InvoiceCollection
-> [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])
-> (InvoiceCollection -> Pair) -> InvoiceCollection -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"invoice_collection" Key -> InvoiceCollection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe InvoiceCollection
subscriptionChangeInvoice_collection SubscriptionChange
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..=)) (SubscriptionChange -> Maybe Text
subscriptionChangeObject SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (PlanMini -> [Pair]) -> Maybe PlanMini -> [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]) -> (PlanMini -> Pair) -> PlanMini -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"plan" Key -> PlanMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe PlanMini
subscriptionChangePlan SubscriptionChange
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..=)) (SubscriptionChange -> Maybe Int
subscriptionChangeQuantity SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> ([SubscriptionRampIntervalResponse] -> [Pair])
-> Maybe [SubscriptionRampIntervalResponse]
-> [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])
-> ([SubscriptionRampIntervalResponse] -> Pair)
-> [SubscriptionRampIntervalResponse]
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"ramp_intervals" Key -> [SubscriptionRampIntervalResponse] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe [SubscriptionRampIntervalResponse]
subscriptionChangeRamp_intervals SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionChangeRevenue_schedule_type -> [Pair])
-> Maybe SubscriptionChangeRevenue_schedule_type
-> [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])
-> (SubscriptionChangeRevenue_schedule_type -> Pair)
-> SubscriptionChangeRevenue_schedule_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"revenue_schedule_type" Key -> SubscriptionChangeRevenue_schedule_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe SubscriptionChangeRevenue_schedule_type
subscriptionChangeRevenue_schedule_type SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionShipping -> [Pair])
-> Maybe SubscriptionShipping
-> [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])
-> (SubscriptionShipping -> Pair) -> SubscriptionShipping -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"shipping" Key -> SubscriptionShipping -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe SubscriptionShipping
subscriptionChangeShipping SubscriptionChange
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
"subscription_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..=)) (SubscriptionChange -> Maybe Text
subscriptionChangeSubscription_id SubscriptionChange
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
"tax_inclusive" Key -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe Bool
subscriptionChangeTax_inclusive SubscriptionChange
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
"unit_amount" Key -> Float -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe Float
subscriptionChangeUnit_amount SubscriptionChange
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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeUpdated_at SubscriptionChange
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: SubscriptionChange -> Encoding
toEncoding SubscriptionChange
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]
-> (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
"activate_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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeActivate_at SubscriptionChange
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
"activated" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe Bool
subscriptionChangeActivated SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([SubscriptionAddOn] -> [Series])
-> Maybe [SubscriptionAddOn]
-> [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])
-> ([SubscriptionAddOn] -> Series)
-> [SubscriptionAddOn]
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_ons" Key -> [SubscriptionAddOn] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe [SubscriptionAddOn]
subscriptionChangeAdd_ons SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionChangeBillingInfo -> [Series])
-> Maybe SubscriptionChangeBillingInfo
-> [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])
-> (SubscriptionChangeBillingInfo -> Series)
-> SubscriptionChangeBillingInfo
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"billing_info" Key -> SubscriptionChangeBillingInfo -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe SubscriptionChangeBillingInfo
subscriptionChangeBilling_info SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (BusinessEntityMini -> [Series])
-> Maybe BusinessEntityMini
-> [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])
-> (BusinessEntityMini -> Series) -> BusinessEntityMini -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"business_entity" Key -> BusinessEntityMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe BusinessEntityMini
subscriptionChangeBusiness_entity SubscriptionChange
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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeCreated_at SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CustomFields -> [Series]) -> Maybe CustomFields -> [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])
-> (CustomFields -> Series) -> CustomFields -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"custom_fields" Key -> CustomFields -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe CustomFields
subscriptionChangeCustom_fields SubscriptionChange
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
"deleted_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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeDeleted_at SubscriptionChange
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..=)) (SubscriptionChange -> Maybe Text
subscriptionChangeId SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (InvoiceCollection -> [Series])
-> Maybe InvoiceCollection
-> [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])
-> (InvoiceCollection -> Series) -> InvoiceCollection -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"invoice_collection" Key -> InvoiceCollection -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe InvoiceCollection
subscriptionChangeInvoice_collection SubscriptionChange
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..=)) (SubscriptionChange -> Maybe Text
subscriptionChangeObject SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (PlanMini -> [Series]) -> Maybe PlanMini -> [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])
-> (PlanMini -> Series) -> PlanMini -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"plan" Key -> PlanMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe PlanMini
subscriptionChangePlan SubscriptionChange
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..=)) (SubscriptionChange -> Maybe Int
subscriptionChangeQuantity SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([SubscriptionRampIntervalResponse] -> [Series])
-> Maybe [SubscriptionRampIntervalResponse]
-> [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])
-> ([SubscriptionRampIntervalResponse] -> Series)
-> [SubscriptionRampIntervalResponse]
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"ramp_intervals" Key -> [SubscriptionRampIntervalResponse] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe [SubscriptionRampIntervalResponse]
subscriptionChangeRamp_intervals SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionChangeRevenue_schedule_type -> [Series])
-> Maybe SubscriptionChangeRevenue_schedule_type
-> [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])
-> (SubscriptionChangeRevenue_schedule_type -> Series)
-> SubscriptionChangeRevenue_schedule_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"revenue_schedule_type" Key -> SubscriptionChangeRevenue_schedule_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe SubscriptionChangeRevenue_schedule_type
subscriptionChangeRevenue_schedule_type SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionShipping -> [Series])
-> Maybe SubscriptionShipping
-> [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])
-> (SubscriptionShipping -> Series)
-> SubscriptionShipping
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"shipping" Key -> SubscriptionShipping -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe SubscriptionShipping
subscriptionChangeShipping SubscriptionChange
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
"subscription_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..=)) (SubscriptionChange -> Maybe Text
subscriptionChangeSubscription_id SubscriptionChange
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
"tax_inclusive" Key -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe Bool
subscriptionChangeTax_inclusive SubscriptionChange
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
"unit_amount" Key -> Float -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionChange -> Maybe Float
subscriptionChangeUnit_amount SubscriptionChange
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..=)) (SubscriptionChange -> Maybe JsonDateTime
subscriptionChangeUpdated_at SubscriptionChange
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionChange where
    parseJSON :: Value -> Parser SubscriptionChange
parseJSON = String
-> (Object -> Parser SubscriptionChange)
-> Value
-> Parser SubscriptionChange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SubscriptionChange" (\Object
obj -> ((((((((((((((((((((Maybe JsonDateTime
 -> Maybe Bool
 -> Maybe [SubscriptionAddOn]
 -> Maybe SubscriptionChangeBillingInfo
 -> Maybe BusinessEntityMini
 -> Maybe JsonDateTime
 -> Maybe CustomFields
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe InvoiceCollection
 -> Maybe Text
 -> Maybe PlanMini
 -> Maybe Int
 -> Maybe [SubscriptionRampIntervalResponse]
 -> Maybe SubscriptionChangeRevenue_schedule_type
 -> Maybe SubscriptionShipping
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Float
 -> Maybe JsonDateTime
 -> SubscriptionChange)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Bool
      -> Maybe [SubscriptionAddOn]
      -> Maybe SubscriptionChangeBillingInfo
      -> Maybe BusinessEntityMini
      -> Maybe JsonDateTime
      -> Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe JsonDateTime
-> Maybe Bool
-> Maybe [SubscriptionAddOn]
-> Maybe SubscriptionChangeBillingInfo
-> Maybe BusinessEntityMini
-> Maybe JsonDateTime
-> Maybe CustomFields
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe InvoiceCollection
-> Maybe Text
-> Maybe PlanMini
-> Maybe Int
-> Maybe [SubscriptionRampIntervalResponse]
-> Maybe SubscriptionChangeRevenue_schedule_type
-> Maybe SubscriptionShipping
-> Maybe Text
-> Maybe Bool
-> Maybe Float
-> Maybe JsonDateTime
-> SubscriptionChange
SubscriptionChange Parser
  (Maybe JsonDateTime
   -> Maybe Bool
   -> Maybe [SubscriptionAddOn]
   -> Maybe SubscriptionChangeBillingInfo
   -> Maybe BusinessEntityMini
   -> Maybe JsonDateTime
   -> Maybe CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Bool
      -> Maybe [SubscriptionAddOn]
      -> Maybe SubscriptionChangeBillingInfo
      -> Maybe BusinessEntityMini
      -> Maybe JsonDateTime
      -> Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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
"activate_at")) Parser
  (Maybe Bool
   -> Maybe [SubscriptionAddOn]
   -> Maybe SubscriptionChangeBillingInfo
   -> Maybe BusinessEntityMini
   -> Maybe JsonDateTime
   -> Maybe CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [SubscriptionAddOn]
      -> Maybe SubscriptionChangeBillingInfo
      -> Maybe BusinessEntityMini
      -> Maybe JsonDateTime
      -> Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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
"activated")) Parser
  (Maybe [SubscriptionAddOn]
   -> Maybe SubscriptionChangeBillingInfo
   -> Maybe BusinessEntityMini
   -> Maybe JsonDateTime
   -> Maybe CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe [SubscriptionAddOn])
-> Parser
     (Maybe SubscriptionChangeBillingInfo
      -> Maybe BusinessEntityMini
      -> Maybe JsonDateTime
      -> Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 [SubscriptionAddOn])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"add_ons")) Parser
  (Maybe SubscriptionChangeBillingInfo
   -> Maybe BusinessEntityMini
   -> Maybe JsonDateTime
   -> Maybe CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe SubscriptionChangeBillingInfo)
-> Parser
     (Maybe BusinessEntityMini
      -> Maybe JsonDateTime
      -> Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 SubscriptionChangeBillingInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"billing_info")) Parser
  (Maybe BusinessEntityMini
   -> Maybe JsonDateTime
   -> Maybe CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe BusinessEntityMini)
-> Parser
     (Maybe JsonDateTime
      -> Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 BusinessEntityMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"business_entity")) Parser
  (Maybe JsonDateTime
   -> Maybe CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe CustomFields
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 CustomFields
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe CustomFields)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 CustomFields)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"custom_fields")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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
"deleted_at")) Parser
  (Maybe Text
   -> Maybe InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe Text)
-> Parser
     (Maybe InvoiceCollection
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 InvoiceCollection
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe InvoiceCollection)
-> Parser
     (Maybe Text
      -> Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 InvoiceCollection)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"invoice_collection")) Parser
  (Maybe Text
   -> Maybe PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe Text)
-> Parser
     (Maybe PlanMini
      -> Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 PlanMini
   -> Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe PlanMini)
-> Parser
     (Maybe Int
      -> Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 PlanMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"plan")) Parser
  (Maybe Int
   -> Maybe [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe Int)
-> Parser
     (Maybe [SubscriptionRampIntervalResponse]
      -> Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 [SubscriptionRampIntervalResponse]
   -> Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe [SubscriptionRampIntervalResponse])
-> Parser
     (Maybe SubscriptionChangeRevenue_schedule_type
      -> Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 [SubscriptionRampIntervalResponse])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"ramp_intervals")) Parser
  (Maybe SubscriptionChangeRevenue_schedule_type
   -> Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe SubscriptionChangeRevenue_schedule_type)
-> Parser
     (Maybe SubscriptionShipping
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 SubscriptionChangeRevenue_schedule_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"revenue_schedule_type")) Parser
  (Maybe SubscriptionShipping
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe SubscriptionShipping)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Float
      -> Maybe JsonDateTime
      -> SubscriptionChange)
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 SubscriptionShipping)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"shipping")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Float
   -> Maybe JsonDateTime
   -> SubscriptionChange)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Float -> Maybe JsonDateTime -> SubscriptionChange)
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
"subscription_id")) Parser
  (Maybe Bool
   -> Maybe Float -> Maybe JsonDateTime -> SubscriptionChange)
-> Parser (Maybe Bool)
-> Parser (Maybe Float -> Maybe JsonDateTime -> SubscriptionChange)
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
"tax_inclusive")) Parser (Maybe Float -> Maybe JsonDateTime -> SubscriptionChange)
-> Parser (Maybe Float)
-> Parser (Maybe JsonDateTime -> SubscriptionChange)
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
"unit_amount")) Parser (Maybe JsonDateTime -> SubscriptionChange)
-> Parser (Maybe JsonDateTime) -> Parser SubscriptionChange
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"))

-- | Create a new 'SubscriptionChange' with all required fields.
mkSubscriptionChange :: SubscriptionChange
mkSubscriptionChange :: SubscriptionChange
mkSubscriptionChange =
    SubscriptionChange
        { subscriptionChangeActivate_at :: Maybe JsonDateTime
subscriptionChangeActivate_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeActivated :: Maybe Bool
subscriptionChangeActivated = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeAdd_ons :: Maybe [SubscriptionAddOn]
subscriptionChangeAdd_ons = Maybe [SubscriptionAddOn]
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeBilling_info :: Maybe SubscriptionChangeBillingInfo
subscriptionChangeBilling_info = Maybe SubscriptionChangeBillingInfo
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeBusiness_entity :: Maybe BusinessEntityMini
subscriptionChangeBusiness_entity = Maybe BusinessEntityMini
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeCreated_at :: Maybe JsonDateTime
subscriptionChangeCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeCustom_fields :: Maybe CustomFields
subscriptionChangeCustom_fields = Maybe CustomFields
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeDeleted_at :: Maybe JsonDateTime
subscriptionChangeDeleted_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeId :: Maybe Text
subscriptionChangeId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeInvoice_collection :: Maybe InvoiceCollection
subscriptionChangeInvoice_collection = Maybe InvoiceCollection
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeObject :: Maybe Text
subscriptionChangeObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangePlan :: Maybe PlanMini
subscriptionChangePlan = Maybe PlanMini
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeQuantity :: Maybe Int
subscriptionChangeQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeRamp_intervals :: Maybe [SubscriptionRampIntervalResponse]
subscriptionChangeRamp_intervals = Maybe [SubscriptionRampIntervalResponse]
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeRevenue_schedule_type :: Maybe SubscriptionChangeRevenue_schedule_type
subscriptionChangeRevenue_schedule_type = Maybe SubscriptionChangeRevenue_schedule_type
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeShipping :: Maybe SubscriptionShipping
subscriptionChangeShipping = Maybe SubscriptionShipping
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeSubscription_id :: Maybe Text
subscriptionChangeSubscription_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeTax_inclusive :: Maybe Bool
subscriptionChangeTax_inclusive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeUnit_amount :: Maybe Float
subscriptionChangeUnit_amount = Maybe Float
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionChangeUpdated_at :: Maybe JsonDateTime
subscriptionChangeUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        }

-- | Defines the enum schema located at @components.schemas.SubscriptionChange.properties.revenue_schedule_type@ in the specification.
data SubscriptionChangeRevenue_schedule_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SubscriptionChangeRevenue_schedule_typeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      SubscriptionChangeRevenue_schedule_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"at_range_end"@
      SubscriptionChangeRevenue_schedule_typeEnumAt_range_end
    | -- | Represents the JSON value @"at_range_start"@
      SubscriptionChangeRevenue_schedule_typeEnumAt_range_start
    | -- | Represents the JSON value @"evenly"@
      SubscriptionChangeRevenue_schedule_typeEnumEvenly
    | -- | Represents the JSON value @"never"@
      SubscriptionChangeRevenue_schedule_typeEnumNever
    deriving (Int -> SubscriptionChangeRevenue_schedule_type -> ShowS
[SubscriptionChangeRevenue_schedule_type] -> ShowS
SubscriptionChangeRevenue_schedule_type -> String
(Int -> SubscriptionChangeRevenue_schedule_type -> ShowS)
-> (SubscriptionChangeRevenue_schedule_type -> String)
-> ([SubscriptionChangeRevenue_schedule_type] -> ShowS)
-> Show SubscriptionChangeRevenue_schedule_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionChangeRevenue_schedule_type -> ShowS
showsPrec :: Int -> SubscriptionChangeRevenue_schedule_type -> ShowS
$cshow :: SubscriptionChangeRevenue_schedule_type -> String
show :: SubscriptionChangeRevenue_schedule_type -> String
$cshowList :: [SubscriptionChangeRevenue_schedule_type] -> ShowS
showList :: [SubscriptionChangeRevenue_schedule_type] -> ShowS
GHC.Show.Show, SubscriptionChangeRevenue_schedule_type
-> SubscriptionChangeRevenue_schedule_type -> Bool
(SubscriptionChangeRevenue_schedule_type
 -> SubscriptionChangeRevenue_schedule_type -> Bool)
-> (SubscriptionChangeRevenue_schedule_type
    -> SubscriptionChangeRevenue_schedule_type -> Bool)
-> Eq SubscriptionChangeRevenue_schedule_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionChangeRevenue_schedule_type
-> SubscriptionChangeRevenue_schedule_type -> Bool
== :: SubscriptionChangeRevenue_schedule_type
-> SubscriptionChangeRevenue_schedule_type -> Bool
$c/= :: SubscriptionChangeRevenue_schedule_type
-> SubscriptionChangeRevenue_schedule_type -> Bool
/= :: SubscriptionChangeRevenue_schedule_type
-> SubscriptionChangeRevenue_schedule_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionChangeRevenue_schedule_type where
    toJSON :: SubscriptionChangeRevenue_schedule_type -> Value
toJSON (SubscriptionChangeRevenue_schedule_typeOther Value
val) = Value
val
    toJSON (SubscriptionChangeRevenue_schedule_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumAt_range_end) = Value
"at_range_end"
    toJSON (SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumAt_range_start) = Value
"at_range_start"
    toJSON (SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumEvenly) = Value
"evenly"
    toJSON (SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumNever) = Value
"never"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionChangeRevenue_schedule_type where
    parseJSON :: Value -> Parser SubscriptionChangeRevenue_schedule_type
parseJSON Value
val =
        SubscriptionChangeRevenue_schedule_type
-> Parser SubscriptionChangeRevenue_schedule_type
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
"at_range_end" -> SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumAt_range_end
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"at_range_start" -> SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumAt_range_start
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"evenly" -> SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumEvenly
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"never" -> SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeEnumNever
                | Bool
GHC.Base.otherwise -> Value -> SubscriptionChangeRevenue_schedule_type
SubscriptionChangeRevenue_schedule_typeOther Value
val
            )