{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.SubscriptionAddOnCreate 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.SubscriptionAddOnPercentageTier
import {-# SOURCE #-} RecurlyClient.Types.SubscriptionAddOnTier
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data SubscriptionAddOnCreate = SubscriptionAddOnCreate
{ SubscriptionAddOnCreate
-> Maybe SubscriptionAddOnCreateAdd_on_source
subscriptionAddOnCreateAdd_on_source :: (GHC.Maybe.Maybe SubscriptionAddOnCreateAdd_on_source)
, SubscriptionAddOnCreate -> Text
subscriptionAddOnCreateCode :: Data.Text.Internal.Text
, SubscriptionAddOnCreate
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnCreatePercentage_tiers :: (GHC.Maybe.Maybe (GHC.Base.NonEmpty SubscriptionAddOnPercentageTier))
, SubscriptionAddOnCreate -> Maybe Int
subscriptionAddOnCreateQuantity :: (GHC.Maybe.Maybe GHC.Types.Int)
, SubscriptionAddOnCreate
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
subscriptionAddOnCreateRevenue_schedule_type :: (GHC.Maybe.Maybe SubscriptionAddOnCreateRevenue_schedule_type)
, SubscriptionAddOnCreate -> Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnCreateTiers :: (GHC.Maybe.Maybe (GHC.Base.NonEmpty SubscriptionAddOnTier))
, SubscriptionAddOnCreate -> Maybe Float
subscriptionAddOnCreateUnit_amount :: (GHC.Maybe.Maybe GHC.Types.Float)
, SubscriptionAddOnCreate -> Maybe Text
subscriptionAddOnCreateUnit_amount_decimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, SubscriptionAddOnCreate -> Maybe Float
subscriptionAddOnCreateUsage_percentage :: (GHC.Maybe.Maybe GHC.Types.Float)
}
deriving
( Int -> SubscriptionAddOnCreate -> ShowS
[SubscriptionAddOnCreate] -> ShowS
SubscriptionAddOnCreate -> String
(Int -> SubscriptionAddOnCreate -> ShowS)
-> (SubscriptionAddOnCreate -> String)
-> ([SubscriptionAddOnCreate] -> ShowS)
-> Show SubscriptionAddOnCreate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnCreate -> ShowS
showsPrec :: Int -> SubscriptionAddOnCreate -> ShowS
$cshow :: SubscriptionAddOnCreate -> String
show :: SubscriptionAddOnCreate -> String
$cshowList :: [SubscriptionAddOnCreate] -> ShowS
showList :: [SubscriptionAddOnCreate] -> ShowS
GHC.Show.Show
, SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool
(SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool)
-> (SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool)
-> Eq SubscriptionAddOnCreate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool
== :: SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool
$c/= :: SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool
/= :: SubscriptionAddOnCreate -> SubscriptionAddOnCreate -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnCreate where
toJSON :: SubscriptionAddOnCreate -> Value
toJSON SubscriptionAddOnCreate
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair]
-> (SubscriptionAddOnCreateAdd_on_source -> [Pair])
-> Maybe SubscriptionAddOnCreateAdd_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])
-> (SubscriptionAddOnCreateAdd_on_source -> Pair)
-> SubscriptionAddOnCreateAdd_on_source
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_on_source" Key -> SubscriptionAddOnCreateAdd_on_source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOnCreate
-> Maybe SubscriptionAddOnCreateAdd_on_source
subscriptionAddOnCreateAdd_on_source SubscriptionAddOnCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Key
"code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..= SubscriptionAddOnCreate -> Text
subscriptionAddOnCreateCode SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnCreatePercentage_tiers SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Int
subscriptionAddOnCreateQuantity SubscriptionAddOnCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (SubscriptionAddOnCreateRevenue_schedule_type -> [Pair])
-> Maybe SubscriptionAddOnCreateRevenue_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])
-> (SubscriptionAddOnCreateRevenue_schedule_type -> Pair)
-> SubscriptionAddOnCreateRevenue_schedule_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"revenue_schedule_type" Key -> SubscriptionAddOnCreateRevenue_schedule_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOnCreate
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
subscriptionAddOnCreateRevenue_schedule_type SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnCreateTiers SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Float
subscriptionAddOnCreateUnit_amount SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Text
subscriptionAddOnCreateUnit_amount_decimal SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Float
subscriptionAddOnCreateUsage_percentage SubscriptionAddOnCreate
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: SubscriptionAddOnCreate -> Encoding
toEncoding SubscriptionAddOnCreate
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]
-> (SubscriptionAddOnCreateAdd_on_source -> [Series])
-> Maybe SubscriptionAddOnCreateAdd_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])
-> (SubscriptionAddOnCreateAdd_on_source -> Series)
-> SubscriptionAddOnCreateAdd_on_source
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"add_on_source" Key -> SubscriptionAddOnCreateAdd_on_source -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOnCreate
-> Maybe SubscriptionAddOnCreateAdd_on_source
subscriptionAddOnCreateAdd_on_source SubscriptionAddOnCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Key
"code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..= SubscriptionAddOnCreate -> Text
subscriptionAddOnCreateCode SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnCreatePercentage_tiers SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Int
subscriptionAddOnCreateQuantity SubscriptionAddOnCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (SubscriptionAddOnCreateRevenue_schedule_type -> [Series])
-> Maybe SubscriptionAddOnCreateRevenue_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])
-> (SubscriptionAddOnCreateRevenue_schedule_type -> Series)
-> SubscriptionAddOnCreateRevenue_schedule_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"revenue_schedule_type" Key -> SubscriptionAddOnCreateRevenue_schedule_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (SubscriptionAddOnCreate
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
subscriptionAddOnCreateRevenue_schedule_type SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnCreateTiers SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Float
subscriptionAddOnCreateUnit_amount SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Text
subscriptionAddOnCreateUnit_amount_decimal SubscriptionAddOnCreate
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..=)) (SubscriptionAddOnCreate -> Maybe Float
subscriptionAddOnCreateUsage_percentage SubscriptionAddOnCreate
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnCreate where
parseJSON :: Value -> Parser SubscriptionAddOnCreate
parseJSON = String
-> (Object -> Parser SubscriptionAddOnCreate)
-> Value
-> Parser SubscriptionAddOnCreate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SubscriptionAddOnCreate" (\Object
obj -> (((((((((Maybe SubscriptionAddOnCreateAdd_on_source
-> Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser
(Maybe SubscriptionAddOnCreateAdd_on_source
-> Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe SubscriptionAddOnCreateAdd_on_source
-> Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate
SubscriptionAddOnCreate Parser
(Maybe SubscriptionAddOnCreateAdd_on_source
-> Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser (Maybe SubscriptionAddOnCreateAdd_on_source)
-> Parser
(Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
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 SubscriptionAddOnCreateAdd_on_source)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"add_on_source")) Parser
(Text
-> Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser Text
-> Parser
(Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
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 Text
forall a. FromJSON a => Object -> Key -> Parser a
Data.Aeson.Types.FromJSON..: Key
"code")) Parser
(Maybe (NonEmpty SubscriptionAddOnPercentageTier)
-> Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser (Maybe (NonEmpty SubscriptionAddOnPercentageTier))
-> Parser
(Maybe Int
-> Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
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 SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser (Maybe Int)
-> Parser
(Maybe SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
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 SubscriptionAddOnCreateRevenue_schedule_type
-> Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser (Maybe SubscriptionAddOnCreateRevenue_schedule_type)
-> Parser
(Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
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 SubscriptionAddOnCreateRevenue_schedule_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"revenue_schedule_type")) Parser
(Maybe (NonEmpty SubscriptionAddOnTier)
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> SubscriptionAddOnCreate)
-> Parser (Maybe (NonEmpty SubscriptionAddOnTier))
-> Parser
(Maybe Float
-> Maybe Text -> Maybe Float -> SubscriptionAddOnCreate)
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 Float -> SubscriptionAddOnCreate)
-> Parser (Maybe Float)
-> Parser (Maybe Text -> Maybe Float -> SubscriptionAddOnCreate)
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 Float -> SubscriptionAddOnCreate)
-> Parser (Maybe Text)
-> Parser (Maybe Float -> SubscriptionAddOnCreate)
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 Float -> SubscriptionAddOnCreate)
-> Parser (Maybe Float) -> Parser SubscriptionAddOnCreate
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"))
mkSubscriptionAddOnCreate ::
Data.Text.Internal.Text ->
SubscriptionAddOnCreate
mkSubscriptionAddOnCreate :: Text -> SubscriptionAddOnCreate
mkSubscriptionAddOnCreate Text
subscriptionAddOnCreateCode =
SubscriptionAddOnCreate
{ subscriptionAddOnCreateAdd_on_source :: Maybe SubscriptionAddOnCreateAdd_on_source
subscriptionAddOnCreateAdd_on_source = Maybe SubscriptionAddOnCreateAdd_on_source
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateCode :: Text
subscriptionAddOnCreateCode = Text
subscriptionAddOnCreateCode
, subscriptionAddOnCreatePercentage_tiers :: Maybe (NonEmpty SubscriptionAddOnPercentageTier)
subscriptionAddOnCreatePercentage_tiers = Maybe (NonEmpty SubscriptionAddOnPercentageTier)
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateQuantity :: Maybe Int
subscriptionAddOnCreateQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateRevenue_schedule_type :: Maybe SubscriptionAddOnCreateRevenue_schedule_type
subscriptionAddOnCreateRevenue_schedule_type = Maybe SubscriptionAddOnCreateRevenue_schedule_type
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateTiers :: Maybe (NonEmpty SubscriptionAddOnTier)
subscriptionAddOnCreateTiers = Maybe (NonEmpty SubscriptionAddOnTier)
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateUnit_amount :: Maybe Float
subscriptionAddOnCreateUnit_amount = Maybe Float
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateUnit_amount_decimal :: Maybe Text
subscriptionAddOnCreateUnit_amount_decimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, subscriptionAddOnCreateUsage_percentage :: Maybe Float
subscriptionAddOnCreateUsage_percentage = Maybe Float
forall a. Maybe a
GHC.Maybe.Nothing
}
data SubscriptionAddOnCreateAdd_on_source
=
SubscriptionAddOnCreateAdd_on_sourceOther Data.Aeson.Types.Internal.Value
|
SubscriptionAddOnCreateAdd_on_sourceTyped Data.Text.Internal.Text
|
SubscriptionAddOnCreateAdd_on_sourceEnumPlan_add_on
|
SubscriptionAddOnCreateAdd_on_sourceEnumItem
deriving (Int -> SubscriptionAddOnCreateAdd_on_source -> ShowS
[SubscriptionAddOnCreateAdd_on_source] -> ShowS
SubscriptionAddOnCreateAdd_on_source -> String
(Int -> SubscriptionAddOnCreateAdd_on_source -> ShowS)
-> (SubscriptionAddOnCreateAdd_on_source -> String)
-> ([SubscriptionAddOnCreateAdd_on_source] -> ShowS)
-> Show SubscriptionAddOnCreateAdd_on_source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnCreateAdd_on_source -> ShowS
showsPrec :: Int -> SubscriptionAddOnCreateAdd_on_source -> ShowS
$cshow :: SubscriptionAddOnCreateAdd_on_source -> String
show :: SubscriptionAddOnCreateAdd_on_source -> String
$cshowList :: [SubscriptionAddOnCreateAdd_on_source] -> ShowS
showList :: [SubscriptionAddOnCreateAdd_on_source] -> ShowS
GHC.Show.Show, SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool
(SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool)
-> (SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool)
-> Eq SubscriptionAddOnCreateAdd_on_source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool
== :: SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool
$c/= :: SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool
/= :: SubscriptionAddOnCreateAdd_on_source
-> SubscriptionAddOnCreateAdd_on_source -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnCreateAdd_on_source where
toJSON :: SubscriptionAddOnCreateAdd_on_source -> Value
toJSON (SubscriptionAddOnCreateAdd_on_sourceOther Value
val) = Value
val
toJSON (SubscriptionAddOnCreateAdd_on_sourceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (SubscriptionAddOnCreateAdd_on_source
SubscriptionAddOnCreateAdd_on_sourceEnumPlan_add_on) = Value
"plan_add_on"
toJSON (SubscriptionAddOnCreateAdd_on_source
SubscriptionAddOnCreateAdd_on_sourceEnumItem) = Value
"item"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnCreateAdd_on_source where
parseJSON :: Value -> Parser SubscriptionAddOnCreateAdd_on_source
parseJSON Value
val =
SubscriptionAddOnCreateAdd_on_source
-> Parser SubscriptionAddOnCreateAdd_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" -> SubscriptionAddOnCreateAdd_on_source
SubscriptionAddOnCreateAdd_on_sourceEnumPlan_add_on
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"item" -> SubscriptionAddOnCreateAdd_on_source
SubscriptionAddOnCreateAdd_on_sourceEnumItem
| Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnCreateAdd_on_source
SubscriptionAddOnCreateAdd_on_sourceOther Value
val
)
data SubscriptionAddOnCreateRevenue_schedule_type
=
SubscriptionAddOnCreateRevenue_schedule_typeOther Data.Aeson.Types.Internal.Value
|
SubscriptionAddOnCreateRevenue_schedule_typeTyped Data.Text.Internal.Text
|
SubscriptionAddOnCreateRevenue_schedule_typeEnumAt_range_end
|
SubscriptionAddOnCreateRevenue_schedule_typeEnumAt_range_start
|
SubscriptionAddOnCreateRevenue_schedule_typeEnumEvenly
|
SubscriptionAddOnCreateRevenue_schedule_typeEnumNever
deriving (Int -> SubscriptionAddOnCreateRevenue_schedule_type -> ShowS
[SubscriptionAddOnCreateRevenue_schedule_type] -> ShowS
SubscriptionAddOnCreateRevenue_schedule_type -> String
(Int -> SubscriptionAddOnCreateRevenue_schedule_type -> ShowS)
-> (SubscriptionAddOnCreateRevenue_schedule_type -> String)
-> ([SubscriptionAddOnCreateRevenue_schedule_type] -> ShowS)
-> Show SubscriptionAddOnCreateRevenue_schedule_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscriptionAddOnCreateRevenue_schedule_type -> ShowS
showsPrec :: Int -> SubscriptionAddOnCreateRevenue_schedule_type -> ShowS
$cshow :: SubscriptionAddOnCreateRevenue_schedule_type -> String
show :: SubscriptionAddOnCreateRevenue_schedule_type -> String
$cshowList :: [SubscriptionAddOnCreateRevenue_schedule_type] -> ShowS
showList :: [SubscriptionAddOnCreateRevenue_schedule_type] -> ShowS
GHC.Show.Show, SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool
(SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool)
-> (SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool)
-> Eq SubscriptionAddOnCreateRevenue_schedule_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool
== :: SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool
$c/= :: SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool
/= :: SubscriptionAddOnCreateRevenue_schedule_type
-> SubscriptionAddOnCreateRevenue_schedule_type -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionAddOnCreateRevenue_schedule_type where
toJSON :: SubscriptionAddOnCreateRevenue_schedule_type -> Value
toJSON (SubscriptionAddOnCreateRevenue_schedule_typeOther Value
val) = Value
val
toJSON (SubscriptionAddOnCreateRevenue_schedule_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumAt_range_end) = Value
"at_range_end"
toJSON (SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumAt_range_start) = Value
"at_range_start"
toJSON (SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumEvenly) = Value
"evenly"
toJSON (SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumNever) = Value
"never"
instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionAddOnCreateRevenue_schedule_type where
parseJSON :: Value -> Parser SubscriptionAddOnCreateRevenue_schedule_type
parseJSON Value
val =
SubscriptionAddOnCreateRevenue_schedule_type
-> Parser SubscriptionAddOnCreateRevenue_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" -> SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumAt_range_end
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"at_range_start" -> SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumAt_range_start
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"evenly" -> SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumEvenly
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"never" -> SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeEnumNever
| Bool
GHC.Base.otherwise -> Value -> SubscriptionAddOnCreateRevenue_schedule_type
SubscriptionAddOnCreateRevenue_schedule_typeOther Value
val
)