{-# 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 SubscriptionScheduleConfigurationItem module StripeAPI.Types.SubscriptionScheduleConfigurationItem 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.Char8 import qualified Data.ByteString.Char8 as Data.ByteString.Internal import qualified Data.Functor import qualified Data.Scientific import qualified Data.Text import qualified 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 StripeAPI.Common import StripeAPI.TypeAlias import {-# SOURCE #-} StripeAPI.Types.DeletedPrice import {-# SOURCE #-} StripeAPI.Types.Price import {-# SOURCE #-} StripeAPI.Types.SubscriptionItemBillingThresholds import {-# SOURCE #-} StripeAPI.Types.TaxRate import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.subscription_schedule_configuration_item@ in the specification. -- -- A phase item describes the price and quantity of a phase. data SubscriptionScheduleConfigurationItem = SubscriptionScheduleConfigurationItem { -- | billing_thresholds: Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period subscriptionScheduleConfigurationItemBillingThresholds :: (GHC.Maybe.Maybe SubscriptionScheduleConfigurationItemBillingThresholds'), -- | price: ID of the price to which the customer should be subscribed. subscriptionScheduleConfigurationItemPrice :: SubscriptionScheduleConfigurationItemPrice'Variants, -- | quantity: Quantity of the plan to which the customer should be subscribed. subscriptionScheduleConfigurationItemQuantity :: (GHC.Maybe.Maybe GHC.Types.Int), -- | tax_rates: The tax rates which apply to this \`phase_item\`. When set, the \`default_tax_rates\` on the phase do not apply to this \`phase_item\`. subscriptionScheduleConfigurationItemTaxRates :: (GHC.Maybe.Maybe ([TaxRate])) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionScheduleConfigurationItem where toJSON obj = Data.Aeson.Types.Internal.object ("billing_thresholds" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemBillingThresholds obj : "price" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemPrice obj : "quantity" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemQuantity obj : "tax_rates" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemTaxRates obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("billing_thresholds" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemBillingThresholds obj) GHC.Base.<> (("price" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemPrice obj) GHC.Base.<> (("quantity" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemQuantity obj) GHC.Base.<> ("tax_rates" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemTaxRates obj)))) instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionScheduleConfigurationItem where parseJSON = Data.Aeson.Types.FromJSON.withObject "SubscriptionScheduleConfigurationItem" (\obj -> (((GHC.Base.pure SubscriptionScheduleConfigurationItem GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "billing_thresholds")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "price")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "quantity")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "tax_rates")) -- | Create a new 'SubscriptionScheduleConfigurationItem' with all required fields. mkSubscriptionScheduleConfigurationItem :: -- | 'subscriptionScheduleConfigurationItemPrice' SubscriptionScheduleConfigurationItemPrice'Variants -> SubscriptionScheduleConfigurationItem mkSubscriptionScheduleConfigurationItem subscriptionScheduleConfigurationItemPrice = SubscriptionScheduleConfigurationItem { subscriptionScheduleConfigurationItemBillingThresholds = GHC.Maybe.Nothing, subscriptionScheduleConfigurationItemPrice = subscriptionScheduleConfigurationItemPrice, subscriptionScheduleConfigurationItemQuantity = GHC.Maybe.Nothing, subscriptionScheduleConfigurationItemTaxRates = GHC.Maybe.Nothing } -- | Defines the object schema located at @components.schemas.subscription_schedule_configuration_item.properties.billing_thresholds.anyOf@ in the specification. -- -- Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period data SubscriptionScheduleConfigurationItemBillingThresholds' = SubscriptionScheduleConfigurationItemBillingThresholds' { -- | usage_gte: Usage threshold that triggers the subscription to create an invoice subscriptionScheduleConfigurationItemBillingThresholds'UsageGte :: (GHC.Maybe.Maybe GHC.Types.Int) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionScheduleConfigurationItemBillingThresholds' where toJSON obj = Data.Aeson.Types.Internal.object ("usage_gte" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemBillingThresholds'UsageGte obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs ("usage_gte" Data.Aeson.Types.ToJSON..= subscriptionScheduleConfigurationItemBillingThresholds'UsageGte obj) instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionScheduleConfigurationItemBillingThresholds' where parseJSON = Data.Aeson.Types.FromJSON.withObject "SubscriptionScheduleConfigurationItemBillingThresholds'" (\obj -> GHC.Base.pure SubscriptionScheduleConfigurationItemBillingThresholds' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "usage_gte")) -- | Create a new 'SubscriptionScheduleConfigurationItemBillingThresholds'' with all required fields. mkSubscriptionScheduleConfigurationItemBillingThresholds' :: SubscriptionScheduleConfigurationItemBillingThresholds' mkSubscriptionScheduleConfigurationItemBillingThresholds' = SubscriptionScheduleConfigurationItemBillingThresholds' {subscriptionScheduleConfigurationItemBillingThresholds'UsageGte = GHC.Maybe.Nothing} -- | Defines the oneOf schema located at @components.schemas.subscription_schedule_configuration_item.properties.price.anyOf@ in the specification. -- -- ID of the price to which the customer should be subscribed. data SubscriptionScheduleConfigurationItemPrice'Variants = SubscriptionScheduleConfigurationItemPrice'Text Data.Text.Internal.Text | SubscriptionScheduleConfigurationItemPrice'Price Price | SubscriptionScheduleConfigurationItemPrice'DeletedPrice DeletedPrice deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON SubscriptionScheduleConfigurationItemPrice'Variants where toJSON (SubscriptionScheduleConfigurationItemPrice'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (SubscriptionScheduleConfigurationItemPrice'Price a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (SubscriptionScheduleConfigurationItemPrice'DeletedPrice a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON SubscriptionScheduleConfigurationItemPrice'Variants where parseJSON val = case (SubscriptionScheduleConfigurationItemPrice'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((SubscriptionScheduleConfigurationItemPrice'Price Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((SubscriptionScheduleConfigurationItemPrice'DeletedPrice Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched")) of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a