{-# 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 SubscriptionAddOn
module RecurlyClient.Types.SubscriptionAddOn 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.AddOnMini
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionAddOnPercentageTier
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionAddOnTier
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

{- | Defines the object schema located at @components.schemas.SubscriptionAddOn@ in the specification.

This links an Add-on to a specific Subscription.
-}
data SubscriptionAddOn = SubscriptionAddOn
    { SubscriptionAddOn -> Maybe AddOnMini
subscriptionAddOnAdd_on :: (GHC.Maybe.Maybe AddOnMini)
    -- ^ add_on: Just the important parts.
    , SubscriptionAddOn -> Maybe SubscriptionAddOnAdd_on_source
subscriptionAddOnAdd_on_source :: (GHC.Maybe.Maybe SubscriptionAddOnAdd_on_source)
    -- ^ add_on_source: Used to determine where the associated add-on data is pulled from. If this value is set to
    -- \`plan_add_on\` or left blank, then add-on data will be pulled from the plan\'s add-ons. If the associated
    -- \`plan\` has \`allow_any_item_on_subscriptions\` set to \`true\` and this field is set to \`item\`, then
    -- the associated add-on data will be pulled from the site\'s item catalog.
    , SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at
    , SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnExpired_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ expired_at
    , SubscriptionAddOn -> Maybe Text
subscriptionAddOnId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , SubscriptionAddOn -> Maybe Text
subscriptionAddOnObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , SubscriptionAddOn
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnPercentage_tiers :: (GHC.Maybe.Maybe (GHC.Base.NonEmpty SubscriptionAddOnPercentageTier))
    -- ^ percentage_tiers: If percentage tiers are provided in the request, all existing percentage tiers on the Subscription Add-on will be
    -- removed and replaced by the percentage tiers in the request. Use only if add_on.tier_type is tiered or volume and
    -- add_on.usage_type is percentage. There must be one tier without an \`ending_amount\` value which represents the final tier.
    -- This feature is currently in development and requires approval and enablement, please contact support.
    --
    --
    -- Constraints:
    --
    -- * Must have a minimum of 1 items
    , SubscriptionAddOn -> Maybe Int
subscriptionAddOnQuantity :: (GHC.Maybe.Maybe GHC.Types.Int)
    -- ^ quantity
    --
    -- Constraints:
    --
    -- * Minimum  of 0.0
    , SubscriptionAddOn -> Maybe SubscriptionAddOnRevenue_schedule_type
subscriptionAddOnRevenue_schedule_type :: (GHC.Maybe.Maybe SubscriptionAddOnRevenue_schedule_type)
    -- ^ revenue_schedule_type
    , SubscriptionAddOn -> Maybe Text
subscriptionAddOnSubscription_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ subscription_id
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , SubscriptionAddOn -> Maybe SubscriptionAddOnTier_type
subscriptionAddOnTier_type :: (GHC.Maybe.Maybe SubscriptionAddOnTier_type)
    -- ^ tier_type: The pricing model for the add-on.  For more information,
    -- [click here](https:\/\/docs.recurly.com\/docs\/billing-models\#section-quantity-based). See our
    -- [Guide](https:\/\/recurly.com\/developers\/guides\/item-addon-guide.html) for an overview of how
    -- to configure quantity-based pricing models.
    , SubscriptionAddOn -> Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnTiers :: (GHC.Maybe.Maybe (GHC.Base.NonEmpty SubscriptionAddOnTier))
    -- ^ tiers: If tiers are provided in the request, all existing tiers on the Subscription Add-on will be
    -- removed and replaced by the tiers in the request. If add_on.tier_type is tiered or volume and
    -- add_on.usage_type is percentage use percentage_tiers instead.
    -- There must be one tier without an \`ending_quantity\` value which represents the final tier.
    --
    --
    -- Constraints:
    --
    -- * Must have a minimum of 1 items
    , SubscriptionAddOn -> Maybe Float
subscriptionAddOnUnit_amount :: (GHC.Maybe.Maybe GHC.Types.Float)
    -- ^ unit_amount: Supports up to 2 decimal places.
    , SubscriptionAddOn -> Maybe Text
subscriptionAddOnUnit_amount_decimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ unit_amount_decimal: Supports up to 9 decimal places.
    , SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at
    , SubscriptionAddOn -> Maybe SubscriptionAddOnUsage_calculation_type
subscriptionAddOnUsage_calculation_type :: (GHC.Maybe.Maybe SubscriptionAddOnUsage_calculation_type)
    -- ^ usage_calculation_type: The type of calculation to be employed for an add-on.  Cumulative billing will sum all usage records created in the current billing cycle.  Last-in-period billing will apply only the most recent usage record in the billing period.  If no value is specified, cumulative billing will be used.
    , SubscriptionAddOn -> Maybe Float
subscriptionAddOnUsage_percentage :: (GHC.Maybe.Maybe GHC.Types.Float)
    -- ^ usage_percentage: The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0. Required if add_on_type is usage and usage_type is percentage.
    , SubscriptionAddOn -> Maybe SubscriptionAddOnUsage_timeframe
subscriptionAddOnUsage_timeframe :: (GHC.Maybe.Maybe SubscriptionAddOnUsage_timeframe)
    -- ^ usage_timeframe: The time at which usage totals are reset for billing purposes.
    }
    deriving
        ( Int -> SubscriptionAddOn -> ShowS
[SubscriptionAddOn] -> ShowS
SubscriptionAddOn -> String
(Int -> SubscriptionAddOn -> ShowS)
-> (SubscriptionAddOn -> String)
-> ([SubscriptionAddOn] -> ShowS)
-> Show SubscriptionAddOn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOn -> ShowS
showsPrec :: Int -> SubscriptionAddOn -> ShowS
$cshow :: SubscriptionAddOn -> String
show :: SubscriptionAddOn -> String
$cshowList :: [SubscriptionAddOn] -> ShowS
showList :: [SubscriptionAddOn] -> ShowS
GHC.Show.Show
        , SubscriptionAddOn -> SubscriptionAddOn -> Bool
(SubscriptionAddOn -> SubscriptionAddOn -> Bool)
-> (SubscriptionAddOn -> SubscriptionAddOn -> Bool)
-> Eq SubscriptionAddOn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOn -> SubscriptionAddOn -> Bool
== :: SubscriptionAddOn -> SubscriptionAddOn -> Bool
$c/= :: SubscriptionAddOn -> SubscriptionAddOn -> Bool
/= :: SubscriptionAddOn -> SubscriptionAddOn -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOn where
    toJSON :: SubscriptionAddOn -> Value
toJSON SubscriptionAddOn
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (AddOnMini -> [Pair]) -> Maybe AddOnMini -> [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]) -> (AddOnMini -> Pair) -> AddOnMini -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_on" Key -> AddOnMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe AddOnMini
subscriptionAddOnAdd_on SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionAddOnAdd_on_source -> [Pair])
-> Maybe SubscriptionAddOnAdd_on_source
-> [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])
-> (SubscriptionAddOnAdd_on_source -> Pair)
-> SubscriptionAddOnAdd_on_source
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_on_source" Key -> SubscriptionAddOnAdd_on_source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnAdd_on_source
subscriptionAddOnAdd_on_source SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnCreated_at SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnExpired_at SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnId SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnObject SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (NonEmpty SubscriptionAddOnPercentageTier -> [Pair])
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> [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])
-> (NonEmpty SubscriptionAddOnPercentageTier -> Pair)
-> NonEmpty SubscriptionAddOnPercentageTier
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"percentage_tiers" Key -> NonEmpty SubscriptionAddOnPercentageTier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnPercentage_tiers SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Int
subscriptionAddOnQuantity SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionAddOnRevenue_schedule_type -> [Pair])
-> Maybe SubscriptionAddOnRevenue_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])
-> (SubscriptionAddOnRevenue_schedule_type -> Pair)
-> SubscriptionAddOnRevenue_schedule_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"revenue_schedule_type" Key -> SubscriptionAddOnRevenue_schedule_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnRevenue_schedule_type
subscriptionAddOnRevenue_schedule_type SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnSubscription_id SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionAddOnTier_type -> [Pair])
-> Maybe SubscriptionAddOnTier_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])
-> (SubscriptionAddOnTier_type -> Pair)
-> SubscriptionAddOnTier_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"tier_type" Key -> SubscriptionAddOnTier_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnTier_type
subscriptionAddOnTier_type SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (NonEmpty SubscriptionAddOnTier -> [Pair])
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> [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])
-> (NonEmpty SubscriptionAddOnTier -> Pair)
-> NonEmpty SubscriptionAddOnTier
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"tiers" Key -> NonEmpty SubscriptionAddOnTier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnTiers SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Float
subscriptionAddOnUnit_amount SubscriptionAddOn
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
"unit_amount_decimal" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnUnit_amount_decimal SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnUpdated_at SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionAddOnUsage_calculation_type -> [Pair])
-> Maybe SubscriptionAddOnUsage_calculation_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])
-> (SubscriptionAddOnUsage_calculation_type -> Pair)
-> SubscriptionAddOnUsage_calculation_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"usage_calculation_type" Key -> SubscriptionAddOnUsage_calculation_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnUsage_calculation_type
subscriptionAddOnUsage_calculation_type SubscriptionAddOn
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
"usage_percentage" Key -> Float -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe Float
subscriptionAddOnUsage_percentage SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionAddOnUsage_timeframe -> [Pair])
-> Maybe SubscriptionAddOnUsage_timeframe
-> [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])
-> (SubscriptionAddOnUsage_timeframe -> Pair)
-> SubscriptionAddOnUsage_timeframe
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"usage_timeframe" Key -> SubscriptionAddOnUsage_timeframe -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnUsage_timeframe
subscriptionAddOnUsage_timeframe SubscriptionAddOn
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: SubscriptionAddOn -> Encoding
toEncoding SubscriptionAddOn
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] -> (AddOnMini -> [Series]) -> Maybe AddOnMini -> [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])
-> (AddOnMini -> Series) -> AddOnMini -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_on" Key -> AddOnMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe AddOnMini
subscriptionAddOnAdd_on SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionAddOnAdd_on_source -> [Series])
-> Maybe SubscriptionAddOnAdd_on_source
-> [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])
-> (SubscriptionAddOnAdd_on_source -> Series)
-> SubscriptionAddOnAdd_on_source
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_on_source" Key -> SubscriptionAddOnAdd_on_source -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnAdd_on_source
subscriptionAddOnAdd_on_source SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnCreated_at SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"expired_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnExpired_at SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnId SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnObject SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (NonEmpty SubscriptionAddOnPercentageTier -> [Series])
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> [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])
-> (NonEmpty SubscriptionAddOnPercentageTier -> Series)
-> NonEmpty SubscriptionAddOnPercentageTier
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"percentage_tiers" Key -> NonEmpty SubscriptionAddOnPercentageTier -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnPercentage_tiers SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Int
subscriptionAddOnQuantity SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionAddOnRevenue_schedule_type -> [Series])
-> Maybe SubscriptionAddOnRevenue_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])
-> (SubscriptionAddOnRevenue_schedule_type -> Series)
-> SubscriptionAddOnRevenue_schedule_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"revenue_schedule_type" Key -> SubscriptionAddOnRevenue_schedule_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnRevenue_schedule_type
subscriptionAddOnRevenue_schedule_type SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnSubscription_id SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionAddOnTier_type -> [Series])
-> Maybe SubscriptionAddOnTier_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])
-> (SubscriptionAddOnTier_type -> Series)
-> SubscriptionAddOnTier_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"tier_type" Key -> SubscriptionAddOnTier_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnTier_type
subscriptionAddOnTier_type SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (NonEmpty SubscriptionAddOnTier -> [Series])
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> [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])
-> (NonEmpty SubscriptionAddOnTier -> Series)
-> NonEmpty SubscriptionAddOnTier
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"tiers" Key -> NonEmpty SubscriptionAddOnTier -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnTiers SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe Float
subscriptionAddOnUnit_amount SubscriptionAddOn
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
"unit_amount_decimal" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe Text
subscriptionAddOnUnit_amount_decimal SubscriptionAddOn
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..=)) (SubscriptionAddOn -> Maybe JsonDateTime
subscriptionAddOnUpdated_at SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionAddOnUsage_calculation_type -> [Series])
-> Maybe SubscriptionAddOnUsage_calculation_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])
-> (SubscriptionAddOnUsage_calculation_type -> Series)
-> SubscriptionAddOnUsage_calculation_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"usage_calculation_type" Key -> SubscriptionAddOnUsage_calculation_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnUsage_calculation_type
subscriptionAddOnUsage_calculation_type SubscriptionAddOn
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
"usage_percentage" Key -> Float -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe Float
subscriptionAddOnUsage_percentage SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionAddOnUsage_timeframe -> [Series])
-> Maybe SubscriptionAddOnUsage_timeframe
-> [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])
-> (SubscriptionAddOnUsage_timeframe -> Series)
-> SubscriptionAddOnUsage_timeframe
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"usage_timeframe" Key -> SubscriptionAddOnUsage_timeframe -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOn -> Maybe SubscriptionAddOnUsage_timeframe
subscriptionAddOnUsage_timeframe SubscriptionAddOn
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOn where
    parseJSON :: Value -> Parser SubscriptionAddOn
parseJSON = String
-> (Object -> Parser SubscriptionAddOn)
-> Value
-> Parser SubscriptionAddOn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SubscriptionAddOn" (\Object
obj -> ((((((((((((((((((Maybe AddOnMini
 -> Maybe SubscriptionAddOnAdd_on_source
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe Text
 -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
 -> Maybe Int
 -> Maybe SubscriptionAddOnRevenue_schedule_type
 -> Maybe Text
 -> Maybe SubscriptionAddOnTier_type
 -> Maybe (NonEmpty SubscriptionAddOnTier)
 -> Maybe Float
 -> Maybe Text
 -> Maybe JsonDateTime
 -> Maybe SubscriptionAddOnUsage_calculation_type
 -> Maybe Float
 -> Maybe SubscriptionAddOnUsage_timeframe
 -> SubscriptionAddOn)
-> Parser
     (Maybe AddOnMini
      -> Maybe SubscriptionAddOnAdd_on_source
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe AddOnMini
-> Maybe SubscriptionAddOnAdd_on_source
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnRevenue_schedule_type
-> Maybe Text
-> Maybe SubscriptionAddOnTier_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe SubscriptionAddOnUsage_calculation_type
-> Maybe Float
-> Maybe SubscriptionAddOnUsage_timeframe
-> SubscriptionAddOn
SubscriptionAddOn Parser
  (Maybe AddOnMini
   -> Maybe SubscriptionAddOnAdd_on_source
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe AddOnMini)
-> Parser
     (Maybe SubscriptionAddOnAdd_on_source
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 AddOnMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"add_on")) Parser
  (Maybe SubscriptionAddOnAdd_on_source
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe SubscriptionAddOnAdd_on_source)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 SubscriptionAddOnAdd_on_source)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"add_on_source")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"expired_at")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
  (Maybe Text
   -> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty SubscriptionAddOnPercentageTier)
      -> Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 (NonEmpty SubscriptionAddOnPercentageTier)
   -> Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe (NonEmpty SubscriptionAddOnPercentageTier))
-> Parser
     (Maybe Int
      -> Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 (NonEmpty SubscriptionAddOnPercentageTier))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"percentage_tiers")) Parser
  (Maybe Int
   -> Maybe SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe Int)
-> Parser
     (Maybe SubscriptionAddOnRevenue_schedule_type
      -> Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 SubscriptionAddOnRevenue_schedule_type
   -> Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe SubscriptionAddOnRevenue_schedule_type)
-> Parser
     (Maybe Text
      -> Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 SubscriptionAddOnRevenue_schedule_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"revenue_schedule_type")) Parser
  (Maybe Text
   -> Maybe SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe Text)
-> Parser
     (Maybe SubscriptionAddOnTier_type
      -> Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 SubscriptionAddOnTier_type
   -> Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe SubscriptionAddOnTier_type)
-> Parser
     (Maybe (NonEmpty SubscriptionAddOnTier)
      -> Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 SubscriptionAddOnTier_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"tier_type")) Parser
  (Maybe (NonEmpty SubscriptionAddOnTier)
   -> Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe (NonEmpty SubscriptionAddOnTier))
-> Parser
     (Maybe Float
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 (NonEmpty SubscriptionAddOnTier))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"tiers")) Parser
  (Maybe Float
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe Float)
-> Parser
     (Maybe Text
      -> Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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 Text
   -> Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe Text)
-> Parser
     (Maybe JsonDateTime
      -> Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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
"unit_amount_decimal")) Parser
  (Maybe JsonDateTime
   -> Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe SubscriptionAddOnUsage_calculation_type
      -> Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe
      -> SubscriptionAddOn)
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")) Parser
  (Maybe SubscriptionAddOnUsage_calculation_type
   -> Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe
   -> SubscriptionAddOn)
-> Parser (Maybe SubscriptionAddOnUsage_calculation_type)
-> Parser
     (Maybe Float
      -> Maybe SubscriptionAddOnUsage_timeframe -> SubscriptionAddOn)
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 SubscriptionAddOnUsage_calculation_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"usage_calculation_type")) Parser
  (Maybe Float
   -> Maybe SubscriptionAddOnUsage_timeframe -> SubscriptionAddOn)
-> Parser (Maybe Float)
-> Parser
     (Maybe SubscriptionAddOnUsage_timeframe -> SubscriptionAddOn)
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
"usage_percentage")) Parser
  (Maybe SubscriptionAddOnUsage_timeframe -> SubscriptionAddOn)
-> Parser (Maybe SubscriptionAddOnUsage_timeframe)
-> Parser SubscriptionAddOn
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 SubscriptionAddOnUsage_timeframe)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"usage_timeframe"))

-- | Create a new 'SubscriptionAddOn' with all required fields.
mkSubscriptionAddOn :: SubscriptionAddOn
mkSubscriptionAddOn :: SubscriptionAddOn
mkSubscriptionAddOn =
    SubscriptionAddOn
        { subscriptionAddOnAdd_on :: Maybe AddOnMini
subscriptionAddOnAdd_on = Maybe AddOnMini
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnAdd_on_source :: Maybe SubscriptionAddOnAdd_on_source
subscriptionAddOnAdd_on_source = Maybe SubscriptionAddOnAdd_on_source
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnCreated_at :: Maybe JsonDateTime
subscriptionAddOnCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnExpired_at :: Maybe JsonDateTime
subscriptionAddOnExpired_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnId :: Maybe Text
subscriptionAddOnId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnObject :: Maybe Text
subscriptionAddOnObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnPercentage_tiers :: Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnPercentage_tiers = Maybe (NonEmpty SubscriptionAddOnPercentageTier)
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnQuantity :: Maybe Int
subscriptionAddOnQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnRevenue_schedule_type :: Maybe SubscriptionAddOnRevenue_schedule_type
subscriptionAddOnRevenue_schedule_type = Maybe SubscriptionAddOnRevenue_schedule_type
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnSubscription_id :: Maybe Text
subscriptionAddOnSubscription_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnTier_type :: Maybe SubscriptionAddOnTier_type
subscriptionAddOnTier_type = Maybe SubscriptionAddOnTier_type
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnTiers :: Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnTiers = Maybe (NonEmpty SubscriptionAddOnTier)
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnUnit_amount :: Maybe Float
subscriptionAddOnUnit_amount = Maybe Float
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnUnit_amount_decimal :: Maybe Text
subscriptionAddOnUnit_amount_decimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnUpdated_at :: Maybe JsonDateTime
subscriptionAddOnUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnUsage_calculation_type :: Maybe SubscriptionAddOnUsage_calculation_type
subscriptionAddOnUsage_calculation_type = Maybe SubscriptionAddOnUsage_calculation_type
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnUsage_percentage :: Maybe Float
subscriptionAddOnUsage_percentage = Maybe Float
forall a. Maybe a
GHC.Maybe.Nothing
        , subscriptionAddOnUsage_timeframe :: Maybe SubscriptionAddOnUsage_timeframe
subscriptionAddOnUsage_timeframe = Maybe SubscriptionAddOnUsage_timeframe
forall a. Maybe a
GHC.Maybe.Nothing
        }

{- | Defines the enum schema located at @components.schemas.SubscriptionAddOn.properties.add_on_source@ in the specification.

Used to determine where the associated add-on data is pulled from. If this value is set to
\`plan_add_on\` or left blank, then add-on data will be pulled from the plan\'s add-ons. If the associated
\`plan\` has \`allow_any_item_on_subscriptions\` set to \`true\` and this field is set to \`item\`, then
the associated add-on data will be pulled from the site\'s item catalog.
-}
data SubscriptionAddOnAdd_on_source
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SubscriptionAddOnAdd_on_sourceOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      SubscriptionAddOnAdd_on_sourceTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"plan_add_on"@
      SubscriptionAddOnAdd_on_sourceEnumPlan_add_on
    | -- | Represents the JSON value @"item"@
      SubscriptionAddOnAdd_on_sourceEnumItem
    deriving (Int -> SubscriptionAddOnAdd_on_source -> ShowS
[SubscriptionAddOnAdd_on_source] -> ShowS
SubscriptionAddOnAdd_on_source -> String
(Int -> SubscriptionAddOnAdd_on_source -> ShowS)
-> (SubscriptionAddOnAdd_on_source -> String)
-> ([SubscriptionAddOnAdd_on_source] -> ShowS)
-> Show SubscriptionAddOnAdd_on_source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnAdd_on_source -> ShowS
showsPrec :: Int -> SubscriptionAddOnAdd_on_source -> ShowS
$cshow :: SubscriptionAddOnAdd_on_source -> String
show :: SubscriptionAddOnAdd_on_source -> String
$cshowList :: [SubscriptionAddOnAdd_on_source] -> ShowS
showList :: [SubscriptionAddOnAdd_on_source] -> ShowS
GHC.Show.Show, SubscriptionAddOnAdd_on_source
-> SubscriptionAddOnAdd_on_source -> Bool
(SubscriptionAddOnAdd_on_source
 -> SubscriptionAddOnAdd_on_source -> Bool)
-> (SubscriptionAddOnAdd_on_source
    -> SubscriptionAddOnAdd_on_source -> Bool)
-> Eq SubscriptionAddOnAdd_on_source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnAdd_on_source
-> SubscriptionAddOnAdd_on_source -> Bool
== :: SubscriptionAddOnAdd_on_source
-> SubscriptionAddOnAdd_on_source -> Bool
$c/= :: SubscriptionAddOnAdd_on_source
-> SubscriptionAddOnAdd_on_source -> Bool
/= :: SubscriptionAddOnAdd_on_source
-> SubscriptionAddOnAdd_on_source -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnAdd_on_source where
    toJSON :: SubscriptionAddOnAdd_on_source -> Value
toJSON (SubscriptionAddOnAdd_on_sourceOther Value
val) = Value
val
    toJSON (SubscriptionAddOnAdd_on_sourceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SubscriptionAddOnAdd_on_source
SubscriptionAddOnAdd_on_sourceEnumPlan_add_on) = Value
"plan_add_on"
    toJSON (SubscriptionAddOnAdd_on_source
SubscriptionAddOnAdd_on_sourceEnumItem) = Value
"item"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnAdd_on_source where
    parseJSON :: Value -> Parser SubscriptionAddOnAdd_on_source
parseJSON Value
val =
        SubscriptionAddOnAdd_on_source
-> Parser SubscriptionAddOnAdd_on_source
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
"plan_add_on" -> SubscriptionAddOnAdd_on_source
SubscriptionAddOnAdd_on_sourceEnumPlan_add_on
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"item" -> SubscriptionAddOnAdd_on_source
SubscriptionAddOnAdd_on_sourceEnumItem
                | Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnAdd_on_source
SubscriptionAddOnAdd_on_sourceOther Value
val
            )

-- | Defines the enum schema located at @components.schemas.SubscriptionAddOn.properties.revenue_schedule_type@ in the specification.
data SubscriptionAddOnRevenue_schedule_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SubscriptionAddOnRevenue_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.
      SubscriptionAddOnRevenue_schedule_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"at_range_end"@
      SubscriptionAddOnRevenue_schedule_typeEnumAt_range_end
    | -- | Represents the JSON value @"at_range_start"@
      SubscriptionAddOnRevenue_schedule_typeEnumAt_range_start
    | -- | Represents the JSON value @"evenly"@
      SubscriptionAddOnRevenue_schedule_typeEnumEvenly
    | -- | Represents the JSON value @"never"@
      SubscriptionAddOnRevenue_schedule_typeEnumNever
    deriving (Int -> SubscriptionAddOnRevenue_schedule_type -> ShowS
[SubscriptionAddOnRevenue_schedule_type] -> ShowS
SubscriptionAddOnRevenue_schedule_type -> String
(Int -> SubscriptionAddOnRevenue_schedule_type -> ShowS)
-> (SubscriptionAddOnRevenue_schedule_type -> String)
-> ([SubscriptionAddOnRevenue_schedule_type] -> ShowS)
-> Show SubscriptionAddOnRevenue_schedule_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnRevenue_schedule_type -> ShowS
showsPrec :: Int -> SubscriptionAddOnRevenue_schedule_type -> ShowS
$cshow :: SubscriptionAddOnRevenue_schedule_type -> String
show :: SubscriptionAddOnRevenue_schedule_type -> String
$cshowList :: [SubscriptionAddOnRevenue_schedule_type] -> ShowS
showList :: [SubscriptionAddOnRevenue_schedule_type] -> ShowS
GHC.Show.Show, SubscriptionAddOnRevenue_schedule_type
-> SubscriptionAddOnRevenue_schedule_type -> Bool
(SubscriptionAddOnRevenue_schedule_type
 -> SubscriptionAddOnRevenue_schedule_type -> Bool)
-> (SubscriptionAddOnRevenue_schedule_type
    -> SubscriptionAddOnRevenue_schedule_type -> Bool)
-> Eq SubscriptionAddOnRevenue_schedule_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnRevenue_schedule_type
-> SubscriptionAddOnRevenue_schedule_type -> Bool
== :: SubscriptionAddOnRevenue_schedule_type
-> SubscriptionAddOnRevenue_schedule_type -> Bool
$c/= :: SubscriptionAddOnRevenue_schedule_type
-> SubscriptionAddOnRevenue_schedule_type -> Bool
/= :: SubscriptionAddOnRevenue_schedule_type
-> SubscriptionAddOnRevenue_schedule_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnRevenue_schedule_type where
    toJSON :: SubscriptionAddOnRevenue_schedule_type -> Value
toJSON (SubscriptionAddOnRevenue_schedule_typeOther Value
val) = Value
val
    toJSON (SubscriptionAddOnRevenue_schedule_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumAt_range_end) = Value
"at_range_end"
    toJSON (SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumAt_range_start) = Value
"at_range_start"
    toJSON (SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumEvenly) = Value
"evenly"
    toJSON (SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumNever) = Value
"never"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnRevenue_schedule_type where
    parseJSON :: Value -> Parser SubscriptionAddOnRevenue_schedule_type
parseJSON Value
val =
        SubscriptionAddOnRevenue_schedule_type
-> Parser SubscriptionAddOnRevenue_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" -> SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumAt_range_end
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"at_range_start" -> SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumAt_range_start
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"evenly" -> SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumEvenly
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"never" -> SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeEnumNever
                | Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnRevenue_schedule_type
SubscriptionAddOnRevenue_schedule_typeOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.SubscriptionAddOn.properties.tier_type@ in the specification.

The pricing model for the add-on.  For more information,
[click here](https:\/\/docs.recurly.com\/docs\/billing-models\#section-quantity-based). See our
[Guide](https:\/\/recurly.com\/developers\/guides\/item-addon-guide.html) for an overview of how
to configure quantity-based pricing models.
-}
data SubscriptionAddOnTier_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SubscriptionAddOnTier_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.
      SubscriptionAddOnTier_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"flat"@
      SubscriptionAddOnTier_typeEnumFlat
    | -- | Represents the JSON value @"tiered"@
      SubscriptionAddOnTier_typeEnumTiered
    | -- | Represents the JSON value @"stairstep"@
      SubscriptionAddOnTier_typeEnumStairstep
    | -- | Represents the JSON value @"volume"@
      SubscriptionAddOnTier_typeEnumVolume
    deriving (Int -> SubscriptionAddOnTier_type -> ShowS
[SubscriptionAddOnTier_type] -> ShowS
SubscriptionAddOnTier_type -> String
(Int -> SubscriptionAddOnTier_type -> ShowS)
-> (SubscriptionAddOnTier_type -> String)
-> ([SubscriptionAddOnTier_type] -> ShowS)
-> Show SubscriptionAddOnTier_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnTier_type -> ShowS
showsPrec :: Int -> SubscriptionAddOnTier_type -> ShowS
$cshow :: SubscriptionAddOnTier_type -> String
show :: SubscriptionAddOnTier_type -> String
$cshowList :: [SubscriptionAddOnTier_type] -> ShowS
showList :: [SubscriptionAddOnTier_type] -> ShowS
GHC.Show.Show, SubscriptionAddOnTier_type -> SubscriptionAddOnTier_type -> Bool
(SubscriptionAddOnTier_type -> SubscriptionAddOnTier_type -> Bool)
-> (SubscriptionAddOnTier_type
    -> SubscriptionAddOnTier_type -> Bool)
-> Eq SubscriptionAddOnTier_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnTier_type -> SubscriptionAddOnTier_type -> Bool
== :: SubscriptionAddOnTier_type -> SubscriptionAddOnTier_type -> Bool
$c/= :: SubscriptionAddOnTier_type -> SubscriptionAddOnTier_type -> Bool
/= :: SubscriptionAddOnTier_type -> SubscriptionAddOnTier_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnTier_type where
    toJSON :: SubscriptionAddOnTier_type -> Value
toJSON (SubscriptionAddOnTier_typeOther Value
val) = Value
val
    toJSON (SubscriptionAddOnTier_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumFlat) = Value
"flat"
    toJSON (SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumTiered) = Value
"tiered"
    toJSON (SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumStairstep) = Value
"stairstep"
    toJSON (SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumVolume) = Value
"volume"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnTier_type where
    parseJSON :: Value -> Parser SubscriptionAddOnTier_type
parseJSON Value
val =
        SubscriptionAddOnTier_type -> Parser SubscriptionAddOnTier_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
"flat" -> SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumFlat
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"tiered" -> SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumTiered
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"stairstep" -> SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumStairstep
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"volume" -> SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeEnumVolume
                | Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnTier_type
SubscriptionAddOnTier_typeOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.SubscriptionAddOn.properties.usage_calculation_type@ in the specification.

The type of calculation to be employed for an add-on.  Cumulative billing will sum all usage records created in the current billing cycle.  Last-in-period billing will apply only the most recent usage record in the billing period.  If no value is specified, cumulative billing will be used.
-}
data SubscriptionAddOnUsage_calculation_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SubscriptionAddOnUsage_calculation_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.
      SubscriptionAddOnUsage_calculation_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"cumulative"@
      SubscriptionAddOnUsage_calculation_typeEnumCumulative
    | -- | Represents the JSON value @"last_in_period"@
      SubscriptionAddOnUsage_calculation_typeEnumLast_in_period
    deriving (Int -> SubscriptionAddOnUsage_calculation_type -> ShowS
[SubscriptionAddOnUsage_calculation_type] -> ShowS
SubscriptionAddOnUsage_calculation_type -> String
(Int -> SubscriptionAddOnUsage_calculation_type -> ShowS)
-> (SubscriptionAddOnUsage_calculation_type -> String)
-> ([SubscriptionAddOnUsage_calculation_type] -> ShowS)
-> Show SubscriptionAddOnUsage_calculation_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnUsage_calculation_type -> ShowS
showsPrec :: Int -> SubscriptionAddOnUsage_calculation_type -> ShowS
$cshow :: SubscriptionAddOnUsage_calculation_type -> String
show :: SubscriptionAddOnUsage_calculation_type -> String
$cshowList :: [SubscriptionAddOnUsage_calculation_type] -> ShowS
showList :: [SubscriptionAddOnUsage_calculation_type] -> ShowS
GHC.Show.Show, SubscriptionAddOnUsage_calculation_type
-> SubscriptionAddOnUsage_calculation_type -> Bool
(SubscriptionAddOnUsage_calculation_type
 -> SubscriptionAddOnUsage_calculation_type -> Bool)
-> (SubscriptionAddOnUsage_calculation_type
    -> SubscriptionAddOnUsage_calculation_type -> Bool)
-> Eq SubscriptionAddOnUsage_calculation_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnUsage_calculation_type
-> SubscriptionAddOnUsage_calculation_type -> Bool
== :: SubscriptionAddOnUsage_calculation_type
-> SubscriptionAddOnUsage_calculation_type -> Bool
$c/= :: SubscriptionAddOnUsage_calculation_type
-> SubscriptionAddOnUsage_calculation_type -> Bool
/= :: SubscriptionAddOnUsage_calculation_type
-> SubscriptionAddOnUsage_calculation_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnUsage_calculation_type where
    toJSON :: SubscriptionAddOnUsage_calculation_type -> Value
toJSON (SubscriptionAddOnUsage_calculation_typeOther Value
val) = Value
val
    toJSON (SubscriptionAddOnUsage_calculation_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SubscriptionAddOnUsage_calculation_type
SubscriptionAddOnUsage_calculation_typeEnumCumulative) = Value
"cumulative"
    toJSON (SubscriptionAddOnUsage_calculation_type
SubscriptionAddOnUsage_calculation_typeEnumLast_in_period) = Value
"last_in_period"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnUsage_calculation_type where
    parseJSON :: Value -> Parser SubscriptionAddOnUsage_calculation_type
parseJSON Value
val =
        SubscriptionAddOnUsage_calculation_type
-> Parser SubscriptionAddOnUsage_calculation_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
"cumulative" -> SubscriptionAddOnUsage_calculation_type
SubscriptionAddOnUsage_calculation_typeEnumCumulative
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"last_in_period" -> SubscriptionAddOnUsage_calculation_type
SubscriptionAddOnUsage_calculation_typeEnumLast_in_period
                | Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnUsage_calculation_type
SubscriptionAddOnUsage_calculation_typeOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.SubscriptionAddOn.properties.usage_timeframe@ in the specification.

The time at which usage totals are reset for billing purposes.
-}
data SubscriptionAddOnUsage_timeframe
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SubscriptionAddOnUsage_timeframeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      SubscriptionAddOnUsage_timeframeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"billing_period"@
      SubscriptionAddOnUsage_timeframeEnumBilling_period
    | -- | Represents the JSON value @"subscription_term"@
      SubscriptionAddOnUsage_timeframeEnumSubscription_term
    deriving (Int -> SubscriptionAddOnUsage_timeframe -> ShowS
[SubscriptionAddOnUsage_timeframe] -> ShowS
SubscriptionAddOnUsage_timeframe -> String
(Int -> SubscriptionAddOnUsage_timeframe -> ShowS)
-> (SubscriptionAddOnUsage_timeframe -> String)
-> ([SubscriptionAddOnUsage_timeframe] -> ShowS)
-> Show SubscriptionAddOnUsage_timeframe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnUsage_timeframe -> ShowS
showsPrec :: Int -> SubscriptionAddOnUsage_timeframe -> ShowS
$cshow :: SubscriptionAddOnUsage_timeframe -> String
show :: SubscriptionAddOnUsage_timeframe -> String
$cshowList :: [SubscriptionAddOnUsage_timeframe] -> ShowS
showList :: [SubscriptionAddOnUsage_timeframe] -> ShowS
GHC.Show.Show, SubscriptionAddOnUsage_timeframe
-> SubscriptionAddOnUsage_timeframe -> Bool
(SubscriptionAddOnUsage_timeframe
 -> SubscriptionAddOnUsage_timeframe -> Bool)
-> (SubscriptionAddOnUsage_timeframe
    -> SubscriptionAddOnUsage_timeframe -> Bool)
-> Eq SubscriptionAddOnUsage_timeframe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnUsage_timeframe
-> SubscriptionAddOnUsage_timeframe -> Bool
== :: SubscriptionAddOnUsage_timeframe
-> SubscriptionAddOnUsage_timeframe -> Bool
$c/= :: SubscriptionAddOnUsage_timeframe
-> SubscriptionAddOnUsage_timeframe -> Bool
/= :: SubscriptionAddOnUsage_timeframe
-> SubscriptionAddOnUsage_timeframe -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnUsage_timeframe where
    toJSON :: SubscriptionAddOnUsage_timeframe -> Value
toJSON (SubscriptionAddOnUsage_timeframeOther Value
val) = Value
val
    toJSON (SubscriptionAddOnUsage_timeframeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SubscriptionAddOnUsage_timeframe
SubscriptionAddOnUsage_timeframeEnumBilling_period) = Value
"billing_period"
    toJSON (SubscriptionAddOnUsage_timeframe
SubscriptionAddOnUsage_timeframeEnumSubscription_term) = Value
"subscription_term"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnUsage_timeframe where
    parseJSON :: Value -> Parser SubscriptionAddOnUsage_timeframe
parseJSON Value
val =
        SubscriptionAddOnUsage_timeframe
-> Parser SubscriptionAddOnUsage_timeframe
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
"billing_period" -> SubscriptionAddOnUsage_timeframe
SubscriptionAddOnUsage_timeframeEnumBilling_period
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"subscription_term" -> SubscriptionAddOnUsage_timeframe
SubscriptionAddOnUsage_timeframeEnumSubscription_term
                | Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnUsage_timeframe
SubscriptionAddOnUsage_timeframeOther Value
val
            )