{-# 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 Price module StripeAPI.Types.Price 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.Foldable import qualified Data.Functor import qualified Data.Maybe 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.CustomUnitAmount import {-# SOURCE #-} StripeAPI.Types.DeletedProduct import {-# SOURCE #-} StripeAPI.Types.PriceTier import {-# SOURCE #-} StripeAPI.Types.Product import {-# SOURCE #-} StripeAPI.Types.Recurring import {-# SOURCE #-} StripeAPI.Types.TransformQuantity import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.price@ in the specification. -- -- Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. -- [Products](https:\/\/stripe.com\/docs\/api\#products) help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme. -- -- For example, you might have a single \"gold\" product that has prices for \$10\/month, \$100\/year, and €9 once. -- -- Related guides: [Set up a subscription](https:\/\/stripe.com\/docs\/billing\/subscriptions\/set-up-subscription), [create an invoice](https:\/\/stripe.com\/docs\/billing\/invoices\/create), and more about [products and prices](https:\/\/stripe.com\/docs\/products-prices\/overview). data Price = Price { -- | active: Whether the price can be used for new purchases. priceActive :: GHC.Types.Bool, -- | billing_scheme: Describes how to compute the price per period. Either \`per_unit\` or \`tiered\`. \`per_unit\` indicates that the fixed amount (specified in \`unit_amount\` or \`unit_amount_decimal\`) will be charged per unit in \`quantity\` (for prices with \`usage_type=licensed\`), or per unit of total usage (for prices with \`usage_type=metered\`). \`tiered\` indicates that the unit pricing will be computed using a tiering strategy as defined using the \`tiers\` and \`tiers_mode\` attributes. priceBillingScheme :: PriceBillingScheme', -- | created: Time at which the object was created. Measured in seconds since the Unix epoch. priceCreated :: GHC.Types.Int, -- | currency: Three-letter [ISO currency code](https:\/\/www.iso.org\/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https:\/\/stripe.com\/docs\/currencies). priceCurrency :: Data.Text.Internal.Text, -- | custom_unit_amount: When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. priceCustomUnitAmount :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable PriceCustomUnitAmount'NonNullable)), -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 priceId :: Data.Text.Internal.Text, -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode. priceLivemode :: GHC.Types.Bool, -- | lookup_key: A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. -- -- Constraints: -- -- * Maximum length of 5000 priceLookupKey :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)), -- | metadata: Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. priceMetadata :: Data.Aeson.Types.Internal.Object, -- | nickname: A brief description of the price, hidden from customers. -- -- Constraints: -- -- * Maximum length of 5000 priceNickname :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)), -- | product: The ID of the product this price is associated with. priceProduct :: PriceProduct'Variants, -- | recurring: The recurring components of a price such as \`interval\` and \`usage_type\`. priceRecurring :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable PriceRecurring'NonNullable)), -- | tax_behavior: Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of \`inclusive\`, \`exclusive\`, or \`unspecified\`. Once specified as either \`inclusive\` or \`exclusive\`, it cannot be changed. priceTaxBehavior :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable PriceTaxBehavior'NonNullable)), -- | tiers: Each element represents a pricing tier. This parameter requires \`billing_scheme\` to be set to \`tiered\`. See also the documentation for \`billing_scheme\`. priceTiers :: (GHC.Maybe.Maybe ([PriceTier])), -- | tiers_mode: Defines if the tiering price should be \`graduated\` or \`volume\` based. In \`volume\`-based tiering, the maximum quantity within a period determines the per unit price. In \`graduated\` tiering, pricing can change as the quantity grows. priceTiersMode :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable PriceTiersMode'NonNullable)), -- | transform_quantity: Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with \`tiers\`. priceTransformQuantity :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable PriceTransformQuantity'NonNullable)), -- | type: One of \`one_time\` or \`recurring\` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. priceType :: PriceType', -- | unit_amount: The unit amount in %s to be charged, represented as a whole integer if possible. Only set if \`billing_scheme=per_unit\`. priceUnitAmount :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)), -- | unit_amount_decimal: The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if \`billing_scheme=per_unit\`. priceUnitAmountDecimal :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON Price where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["active" Data.Aeson.Types.ToJSON..= priceActive obj] : ["billing_scheme" Data.Aeson.Types.ToJSON..= priceBillingScheme obj] : ["created" Data.Aeson.Types.ToJSON..= priceCreated obj] : ["currency" Data.Aeson.Types.ToJSON..= priceCurrency obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("custom_unit_amount" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount obj) : ["id" Data.Aeson.Types.ToJSON..= priceId obj] : ["livemode" Data.Aeson.Types.ToJSON..= priceLivemode obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("lookup_key" Data.Aeson.Types.ToJSON..=)) (priceLookupKey obj) : ["metadata" Data.Aeson.Types.ToJSON..= priceMetadata obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("nickname" Data.Aeson.Types.ToJSON..=)) (priceNickname obj) : ["product" Data.Aeson.Types.ToJSON..= priceProduct obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("recurring" Data.Aeson.Types.ToJSON..=)) (priceRecurring obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("tax_behavior" Data.Aeson.Types.ToJSON..=)) (priceTaxBehavior obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("tiers" Data.Aeson.Types.ToJSON..=)) (priceTiers obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("tiers_mode" Data.Aeson.Types.ToJSON..=)) (priceTiersMode obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("transform_quantity" Data.Aeson.Types.ToJSON..=)) (priceTransformQuantity obj) : ["type" Data.Aeson.Types.ToJSON..= priceType obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("unit_amount" Data.Aeson.Types.ToJSON..=)) (priceUnitAmount obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("unit_amount_decimal" Data.Aeson.Types.ToJSON..=)) (priceUnitAmountDecimal obj) : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "price"] : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["active" Data.Aeson.Types.ToJSON..= priceActive obj] : ["billing_scheme" Data.Aeson.Types.ToJSON..= priceBillingScheme obj] : ["created" Data.Aeson.Types.ToJSON..= priceCreated obj] : ["currency" Data.Aeson.Types.ToJSON..= priceCurrency obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("custom_unit_amount" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount obj) : ["id" Data.Aeson.Types.ToJSON..= priceId obj] : ["livemode" Data.Aeson.Types.ToJSON..= priceLivemode obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("lookup_key" Data.Aeson.Types.ToJSON..=)) (priceLookupKey obj) : ["metadata" Data.Aeson.Types.ToJSON..= priceMetadata obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("nickname" Data.Aeson.Types.ToJSON..=)) (priceNickname obj) : ["product" Data.Aeson.Types.ToJSON..= priceProduct obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("recurring" Data.Aeson.Types.ToJSON..=)) (priceRecurring obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("tax_behavior" Data.Aeson.Types.ToJSON..=)) (priceTaxBehavior obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("tiers" Data.Aeson.Types.ToJSON..=)) (priceTiers obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("tiers_mode" Data.Aeson.Types.ToJSON..=)) (priceTiersMode obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("transform_quantity" Data.Aeson.Types.ToJSON..=)) (priceTransformQuantity obj) : ["type" Data.Aeson.Types.ToJSON..= priceType obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("unit_amount" Data.Aeson.Types.ToJSON..=)) (priceUnitAmount obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("unit_amount_decimal" Data.Aeson.Types.ToJSON..=)) (priceUnitAmountDecimal obj) : ["object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "price"] : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON Price where parseJSON = Data.Aeson.Types.FromJSON.withObject "Price" (\obj -> ((((((((((((((((((GHC.Base.pure Price GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "active")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "billing_scheme")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "created")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "custom_unit_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "livemode")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "lookup_key")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "metadata")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "nickname")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "product")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "recurring")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "tax_behavior")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "tiers")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "tiers_mode")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "transform_quantity")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "type")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "unit_amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "unit_amount_decimal")) -- | Create a new 'Price' with all required fields. mkPrice :: -- | 'priceActive' GHC.Types.Bool -> -- | 'priceBillingScheme' PriceBillingScheme' -> -- | 'priceCreated' GHC.Types.Int -> -- | 'priceCurrency' Data.Text.Internal.Text -> -- | 'priceId' Data.Text.Internal.Text -> -- | 'priceLivemode' GHC.Types.Bool -> -- | 'priceMetadata' Data.Aeson.Types.Internal.Object -> -- | 'priceProduct' PriceProduct'Variants -> -- | 'priceType' PriceType' -> Price mkPrice priceActive priceBillingScheme priceCreated priceCurrency priceId priceLivemode priceMetadata priceProduct priceType = Price { priceActive = priceActive, priceBillingScheme = priceBillingScheme, priceCreated = priceCreated, priceCurrency = priceCurrency, priceCustomUnitAmount = GHC.Maybe.Nothing, priceId = priceId, priceLivemode = priceLivemode, priceLookupKey = GHC.Maybe.Nothing, priceMetadata = priceMetadata, priceNickname = GHC.Maybe.Nothing, priceProduct = priceProduct, priceRecurring = GHC.Maybe.Nothing, priceTaxBehavior = GHC.Maybe.Nothing, priceTiers = GHC.Maybe.Nothing, priceTiersMode = GHC.Maybe.Nothing, priceTransformQuantity = GHC.Maybe.Nothing, priceType = priceType, priceUnitAmount = GHC.Maybe.Nothing, priceUnitAmountDecimal = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.price.properties.billing_scheme@ in the specification. -- -- Describes how to compute the price per period. Either \`per_unit\` or \`tiered\`. \`per_unit\` indicates that the fixed amount (specified in \`unit_amount\` or \`unit_amount_decimal\`) will be charged per unit in \`quantity\` (for prices with \`usage_type=licensed\`), or per unit of total usage (for prices with \`usage_type=metered\`). \`tiered\` indicates that the unit pricing will be computed using a tiering strategy as defined using the \`tiers\` and \`tiers_mode\` attributes. data PriceBillingScheme' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceBillingScheme'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceBillingScheme'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"per_unit"@ PriceBillingScheme'EnumPerUnit | -- | Represents the JSON value @"tiered"@ PriceBillingScheme'EnumTiered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceBillingScheme' where toJSON (PriceBillingScheme'Other val) = val toJSON (PriceBillingScheme'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceBillingScheme'EnumPerUnit) = "per_unit" toJSON (PriceBillingScheme'EnumTiered) = "tiered" instance Data.Aeson.Types.FromJSON.FromJSON PriceBillingScheme' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "per_unit" -> PriceBillingScheme'EnumPerUnit | val GHC.Classes.== "tiered" -> PriceBillingScheme'EnumTiered | GHC.Base.otherwise -> PriceBillingScheme'Other val ) -- | Defines the object schema located at @components.schemas.price.properties.custom_unit_amount.anyOf@ in the specification. -- -- When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. data PriceCustomUnitAmount'NonNullable = PriceCustomUnitAmount'NonNullable { -- | maximum: The maximum unit amount the customer can specify for this item. priceCustomUnitAmount'NonNullableMaximum :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)), -- | minimum: The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. priceCustomUnitAmount'NonNullableMinimum :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)), -- | preset: The starting unit amount which can be updated by the customer. priceCustomUnitAmount'NonNullablePreset :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable GHC.Types.Int)) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PriceCustomUnitAmount'NonNullable where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("maximum" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount'NonNullableMaximum obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("minimum" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount'NonNullableMinimum obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("preset" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount'NonNullablePreset obj) : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("maximum" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount'NonNullableMaximum obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("minimum" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount'NonNullableMinimum obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("preset" Data.Aeson.Types.ToJSON..=)) (priceCustomUnitAmount'NonNullablePreset obj) : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON PriceCustomUnitAmount'NonNullable where parseJSON = Data.Aeson.Types.FromJSON.withObject "PriceCustomUnitAmount'NonNullable" (\obj -> ((GHC.Base.pure PriceCustomUnitAmount'NonNullable GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "maximum")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "minimum")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "preset")) -- | Create a new 'PriceCustomUnitAmount'NonNullable' with all required fields. mkPriceCustomUnitAmount'NonNullable :: PriceCustomUnitAmount'NonNullable mkPriceCustomUnitAmount'NonNullable = PriceCustomUnitAmount'NonNullable { priceCustomUnitAmount'NonNullableMaximum = GHC.Maybe.Nothing, priceCustomUnitAmount'NonNullableMinimum = GHC.Maybe.Nothing, priceCustomUnitAmount'NonNullablePreset = GHC.Maybe.Nothing } -- | Defines the oneOf schema located at @components.schemas.price.properties.product.anyOf@ in the specification. -- -- The ID of the product this price is associated with. data PriceProduct'Variants = PriceProduct'Text Data.Text.Internal.Text | PriceProduct'Product Product | PriceProduct'DeletedProduct DeletedProduct deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceProduct'Variants where toJSON (PriceProduct'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PriceProduct'Product a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (PriceProduct'DeletedProduct a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON PriceProduct'Variants where parseJSON val = case (PriceProduct'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((PriceProduct'Product Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((PriceProduct'DeletedProduct 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 -- | Defines the object schema located at @components.schemas.price.properties.recurring.anyOf@ in the specification. -- -- The recurring components of a price such as \\\`interval\\\` and \\\`usage_type\\\`. data PriceRecurring'NonNullable = PriceRecurring'NonNullable { -- | aggregate_usage: Specifies a usage aggregation strategy for prices of \`usage_type=metered\`. Allowed values are \`sum\` for summing up all usage during a period, \`last_during_period\` for using the last usage record reported within a period, \`last_ever\` for using the last usage record ever (across period bounds) or \`max\` which uses the usage record with the maximum reported usage during a period. Defaults to \`sum\`. priceRecurring'NonNullableAggregateUsage :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable PriceRecurring'NonNullableAggregateUsage'NonNullable)), -- | interval: The frequency at which a subscription is billed. One of \`day\`, \`week\`, \`month\` or \`year\`. priceRecurring'NonNullableInterval :: (GHC.Maybe.Maybe PriceRecurring'NonNullableInterval'), -- | interval_count: The number of intervals (specified in the \`interval\` attribute) between subscription billings. For example, \`interval=month\` and \`interval_count=3\` bills every 3 months. priceRecurring'NonNullableIntervalCount :: (GHC.Maybe.Maybe GHC.Types.Int), -- | usage_type: Configures how the quantity per period should be determined. Can be either \`metered\` or \`licensed\`. \`licensed\` automatically bills the \`quantity\` set when adding it to a subscription. \`metered\` aggregates the total usage based on usage records. Defaults to \`licensed\`. priceRecurring'NonNullableUsageType :: (GHC.Maybe.Maybe PriceRecurring'NonNullableUsageType') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'NonNullable where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("aggregate_usage" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableAggregateUsage obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("interval" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableInterval obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("interval_count" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableIntervalCount obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("usage_type" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableUsageType obj) : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("aggregate_usage" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableAggregateUsage obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("interval" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableInterval obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("interval_count" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableIntervalCount obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("usage_type" Data.Aeson.Types.ToJSON..=)) (priceRecurring'NonNullableUsageType obj) : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'NonNullable where parseJSON = Data.Aeson.Types.FromJSON.withObject "PriceRecurring'NonNullable" (\obj -> (((GHC.Base.pure PriceRecurring'NonNullable GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "aggregate_usage")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "interval")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "interval_count")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "usage_type")) -- | Create a new 'PriceRecurring'NonNullable' with all required fields. mkPriceRecurring'NonNullable :: PriceRecurring'NonNullable mkPriceRecurring'NonNullable = PriceRecurring'NonNullable { priceRecurring'NonNullableAggregateUsage = GHC.Maybe.Nothing, priceRecurring'NonNullableInterval = GHC.Maybe.Nothing, priceRecurring'NonNullableIntervalCount = GHC.Maybe.Nothing, priceRecurring'NonNullableUsageType = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.price.properties.recurring.anyOf.properties.aggregate_usage@ in the specification. -- -- Specifies a usage aggregation strategy for prices of \`usage_type=metered\`. Allowed values are \`sum\` for summing up all usage during a period, \`last_during_period\` for using the last usage record reported within a period, \`last_ever\` for using the last usage record ever (across period bounds) or \`max\` which uses the usage record with the maximum reported usage during a period. Defaults to \`sum\`. data PriceRecurring'NonNullableAggregateUsage'NonNullable = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceRecurring'NonNullableAggregateUsage'NonNullableOther Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceRecurring'NonNullableAggregateUsage'NonNullableTyped Data.Text.Internal.Text | -- | Represents the JSON value @"last_during_period"@ PriceRecurring'NonNullableAggregateUsage'NonNullableEnumLastDuringPeriod | -- | Represents the JSON value @"last_ever"@ PriceRecurring'NonNullableAggregateUsage'NonNullableEnumLastEver | -- | Represents the JSON value @"max"@ PriceRecurring'NonNullableAggregateUsage'NonNullableEnumMax | -- | Represents the JSON value @"sum"@ PriceRecurring'NonNullableAggregateUsage'NonNullableEnumSum deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'NonNullableAggregateUsage'NonNullable where toJSON (PriceRecurring'NonNullableAggregateUsage'NonNullableOther val) = val toJSON (PriceRecurring'NonNullableAggregateUsage'NonNullableTyped val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceRecurring'NonNullableAggregateUsage'NonNullableEnumLastDuringPeriod) = "last_during_period" toJSON (PriceRecurring'NonNullableAggregateUsage'NonNullableEnumLastEver) = "last_ever" toJSON (PriceRecurring'NonNullableAggregateUsage'NonNullableEnumMax) = "max" toJSON (PriceRecurring'NonNullableAggregateUsage'NonNullableEnumSum) = "sum" instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'NonNullableAggregateUsage'NonNullable where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "last_during_period" -> PriceRecurring'NonNullableAggregateUsage'NonNullableEnumLastDuringPeriod | val GHC.Classes.== "last_ever" -> PriceRecurring'NonNullableAggregateUsage'NonNullableEnumLastEver | val GHC.Classes.== "max" -> PriceRecurring'NonNullableAggregateUsage'NonNullableEnumMax | val GHC.Classes.== "sum" -> PriceRecurring'NonNullableAggregateUsage'NonNullableEnumSum | GHC.Base.otherwise -> PriceRecurring'NonNullableAggregateUsage'NonNullableOther val ) -- | Defines the enum schema located at @components.schemas.price.properties.recurring.anyOf.properties.interval@ in the specification. -- -- The frequency at which a subscription is billed. One of \`day\`, \`week\`, \`month\` or \`year\`. data PriceRecurring'NonNullableInterval' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceRecurring'NonNullableInterval'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceRecurring'NonNullableInterval'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"day"@ PriceRecurring'NonNullableInterval'EnumDay | -- | Represents the JSON value @"month"@ PriceRecurring'NonNullableInterval'EnumMonth | -- | Represents the JSON value @"week"@ PriceRecurring'NonNullableInterval'EnumWeek | -- | Represents the JSON value @"year"@ PriceRecurring'NonNullableInterval'EnumYear deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'NonNullableInterval' where toJSON (PriceRecurring'NonNullableInterval'Other val) = val toJSON (PriceRecurring'NonNullableInterval'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceRecurring'NonNullableInterval'EnumDay) = "day" toJSON (PriceRecurring'NonNullableInterval'EnumMonth) = "month" toJSON (PriceRecurring'NonNullableInterval'EnumWeek) = "week" toJSON (PriceRecurring'NonNullableInterval'EnumYear) = "year" instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'NonNullableInterval' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "day" -> PriceRecurring'NonNullableInterval'EnumDay | val GHC.Classes.== "month" -> PriceRecurring'NonNullableInterval'EnumMonth | val GHC.Classes.== "week" -> PriceRecurring'NonNullableInterval'EnumWeek | val GHC.Classes.== "year" -> PriceRecurring'NonNullableInterval'EnumYear | GHC.Base.otherwise -> PriceRecurring'NonNullableInterval'Other val ) -- | Defines the enum schema located at @components.schemas.price.properties.recurring.anyOf.properties.usage_type@ in the specification. -- -- Configures how the quantity per period should be determined. Can be either \`metered\` or \`licensed\`. \`licensed\` automatically bills the \`quantity\` set when adding it to a subscription. \`metered\` aggregates the total usage based on usage records. Defaults to \`licensed\`. data PriceRecurring'NonNullableUsageType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceRecurring'NonNullableUsageType'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceRecurring'NonNullableUsageType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"licensed"@ PriceRecurring'NonNullableUsageType'EnumLicensed | -- | Represents the JSON value @"metered"@ PriceRecurring'NonNullableUsageType'EnumMetered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'NonNullableUsageType' where toJSON (PriceRecurring'NonNullableUsageType'Other val) = val toJSON (PriceRecurring'NonNullableUsageType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceRecurring'NonNullableUsageType'EnumLicensed) = "licensed" toJSON (PriceRecurring'NonNullableUsageType'EnumMetered) = "metered" instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'NonNullableUsageType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "licensed" -> PriceRecurring'NonNullableUsageType'EnumLicensed | val GHC.Classes.== "metered" -> PriceRecurring'NonNullableUsageType'EnumMetered | GHC.Base.otherwise -> PriceRecurring'NonNullableUsageType'Other val ) -- | Defines the enum schema located at @components.schemas.price.properties.tax_behavior@ in the specification. -- -- Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of \`inclusive\`, \`exclusive\`, or \`unspecified\`. Once specified as either \`inclusive\` or \`exclusive\`, it cannot be changed. data PriceTaxBehavior'NonNullable = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceTaxBehavior'NonNullableOther Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceTaxBehavior'NonNullableTyped Data.Text.Internal.Text | -- | Represents the JSON value @"exclusive"@ PriceTaxBehavior'NonNullableEnumExclusive | -- | Represents the JSON value @"inclusive"@ PriceTaxBehavior'NonNullableEnumInclusive | -- | Represents the JSON value @"unspecified"@ PriceTaxBehavior'NonNullableEnumUnspecified deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceTaxBehavior'NonNullable where toJSON (PriceTaxBehavior'NonNullableOther val) = val toJSON (PriceTaxBehavior'NonNullableTyped val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceTaxBehavior'NonNullableEnumExclusive) = "exclusive" toJSON (PriceTaxBehavior'NonNullableEnumInclusive) = "inclusive" toJSON (PriceTaxBehavior'NonNullableEnumUnspecified) = "unspecified" instance Data.Aeson.Types.FromJSON.FromJSON PriceTaxBehavior'NonNullable where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "exclusive" -> PriceTaxBehavior'NonNullableEnumExclusive | val GHC.Classes.== "inclusive" -> PriceTaxBehavior'NonNullableEnumInclusive | val GHC.Classes.== "unspecified" -> PriceTaxBehavior'NonNullableEnumUnspecified | GHC.Base.otherwise -> PriceTaxBehavior'NonNullableOther val ) -- | Defines the enum schema located at @components.schemas.price.properties.tiers_mode@ in the specification. -- -- Defines if the tiering price should be \`graduated\` or \`volume\` based. In \`volume\`-based tiering, the maximum quantity within a period determines the per unit price. In \`graduated\` tiering, pricing can change as the quantity grows. data PriceTiersMode'NonNullable = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceTiersMode'NonNullableOther Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceTiersMode'NonNullableTyped Data.Text.Internal.Text | -- | Represents the JSON value @"graduated"@ PriceTiersMode'NonNullableEnumGraduated | -- | Represents the JSON value @"volume"@ PriceTiersMode'NonNullableEnumVolume deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceTiersMode'NonNullable where toJSON (PriceTiersMode'NonNullableOther val) = val toJSON (PriceTiersMode'NonNullableTyped val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceTiersMode'NonNullableEnumGraduated) = "graduated" toJSON (PriceTiersMode'NonNullableEnumVolume) = "volume" instance Data.Aeson.Types.FromJSON.FromJSON PriceTiersMode'NonNullable where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "graduated" -> PriceTiersMode'NonNullableEnumGraduated | val GHC.Classes.== "volume" -> PriceTiersMode'NonNullableEnumVolume | GHC.Base.otherwise -> PriceTiersMode'NonNullableOther val ) -- | Defines the object schema located at @components.schemas.price.properties.transform_quantity.anyOf@ in the specification. -- -- Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with \\\`tiers\\\`. data PriceTransformQuantity'NonNullable = PriceTransformQuantity'NonNullable { -- | divide_by: Divide usage by this number. priceTransformQuantity'NonNullableDivideBy :: (GHC.Maybe.Maybe GHC.Types.Int), -- | round: After division, either round the result \`up\` or \`down\`. priceTransformQuantity'NonNullableRound :: (GHC.Maybe.Maybe PriceTransformQuantity'NonNullableRound') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PriceTransformQuantity'NonNullable where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("divide_by" Data.Aeson.Types.ToJSON..=)) (priceTransformQuantity'NonNullableDivideBy obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("round" Data.Aeson.Types.ToJSON..=)) (priceTransformQuantity'NonNullableRound obj) : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("divide_by" Data.Aeson.Types.ToJSON..=)) (priceTransformQuantity'NonNullableDivideBy obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("round" Data.Aeson.Types.ToJSON..=)) (priceTransformQuantity'NonNullableRound obj) : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON PriceTransformQuantity'NonNullable where parseJSON = Data.Aeson.Types.FromJSON.withObject "PriceTransformQuantity'NonNullable" (\obj -> (GHC.Base.pure PriceTransformQuantity'NonNullable GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "divide_by")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "round")) -- | Create a new 'PriceTransformQuantity'NonNullable' with all required fields. mkPriceTransformQuantity'NonNullable :: PriceTransformQuantity'NonNullable mkPriceTransformQuantity'NonNullable = PriceTransformQuantity'NonNullable { priceTransformQuantity'NonNullableDivideBy = GHC.Maybe.Nothing, priceTransformQuantity'NonNullableRound = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.price.properties.transform_quantity.anyOf.properties.round@ in the specification. -- -- After division, either round the result \`up\` or \`down\`. data PriceTransformQuantity'NonNullableRound' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceTransformQuantity'NonNullableRound'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceTransformQuantity'NonNullableRound'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"down"@ PriceTransformQuantity'NonNullableRound'EnumDown | -- | Represents the JSON value @"up"@ PriceTransformQuantity'NonNullableRound'EnumUp deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceTransformQuantity'NonNullableRound' where toJSON (PriceTransformQuantity'NonNullableRound'Other val) = val toJSON (PriceTransformQuantity'NonNullableRound'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceTransformQuantity'NonNullableRound'EnumDown) = "down" toJSON (PriceTransformQuantity'NonNullableRound'EnumUp) = "up" instance Data.Aeson.Types.FromJSON.FromJSON PriceTransformQuantity'NonNullableRound' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "down" -> PriceTransformQuantity'NonNullableRound'EnumDown | val GHC.Classes.== "up" -> PriceTransformQuantity'NonNullableRound'EnumUp | GHC.Base.otherwise -> PriceTransformQuantity'NonNullableRound'Other val ) -- | Defines the enum schema located at @components.schemas.price.properties.type@ in the specification. -- -- One of \`one_time\` or \`recurring\` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. data PriceType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceType'Other Data.Aeson.Types.Internal.Value | -- | This constructor can be used to send values to the server which are not present in the specification yet. PriceType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"one_time"@ PriceType'EnumOneTime | -- | Represents the JSON value @"recurring"@ PriceType'EnumRecurring deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceType' where toJSON (PriceType'Other val) = val toJSON (PriceType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceType'EnumOneTime) = "one_time" toJSON (PriceType'EnumRecurring) = "recurring" instance Data.Aeson.Types.FromJSON.FromJSON PriceType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "one_time" -> PriceType'EnumOneTime | val GHC.Classes.== "recurring" -> PriceType'EnumRecurring | GHC.Base.otherwise -> PriceType'Other val )