{-# 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.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.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\/billing\/prices-guide). 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, -- | 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. -- -- Constraints: -- -- * Maximum length of 5000 priceLookupKey :: (GHC.Maybe.Maybe 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 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 PriceRecurring'), -- | 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 PriceTaxBehavior'), -- | 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 PriceTiersMode'), -- | 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 PriceTransformQuantity'), -- | 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 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 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 ("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 : "id" Data.Aeson.Types.ToJSON..= priceId obj : "livemode" Data.Aeson.Types.ToJSON..= priceLivemode obj : "lookup_key" Data.Aeson.Types.ToJSON..= priceLookupKey obj : "metadata" Data.Aeson.Types.ToJSON..= priceMetadata obj : "nickname" Data.Aeson.Types.ToJSON..= priceNickname obj : "product" Data.Aeson.Types.ToJSON..= priceProduct obj : "recurring" Data.Aeson.Types.ToJSON..= priceRecurring obj : "tax_behavior" Data.Aeson.Types.ToJSON..= priceTaxBehavior obj : "tiers" Data.Aeson.Types.ToJSON..= priceTiers obj : "tiers_mode" Data.Aeson.Types.ToJSON..= priceTiersMode obj : "transform_quantity" Data.Aeson.Types.ToJSON..= priceTransformQuantity obj : "type" Data.Aeson.Types.ToJSON..= priceType obj : "unit_amount" Data.Aeson.Types.ToJSON..= priceUnitAmount obj : "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 (("active" Data.Aeson.Types.ToJSON..= priceActive obj) GHC.Base.<> (("billing_scheme" Data.Aeson.Types.ToJSON..= priceBillingScheme obj) GHC.Base.<> (("created" Data.Aeson.Types.ToJSON..= priceCreated obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= priceCurrency obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= priceId obj) GHC.Base.<> (("livemode" Data.Aeson.Types.ToJSON..= priceLivemode obj) GHC.Base.<> (("lookup_key" Data.Aeson.Types.ToJSON..= priceLookupKey obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= priceMetadata obj) GHC.Base.<> (("nickname" Data.Aeson.Types.ToJSON..= priceNickname obj) GHC.Base.<> (("product" Data.Aeson.Types.ToJSON..= priceProduct obj) GHC.Base.<> (("recurring" Data.Aeson.Types.ToJSON..= priceRecurring obj) GHC.Base.<> (("tax_behavior" Data.Aeson.Types.ToJSON..= priceTaxBehavior obj) GHC.Base.<> (("tiers" Data.Aeson.Types.ToJSON..= priceTiers obj) GHC.Base.<> (("tiers_mode" Data.Aeson.Types.ToJSON..= priceTiersMode obj) GHC.Base.<> (("transform_quantity" Data.Aeson.Types.ToJSON..= priceTransformQuantity obj) GHC.Base.<> (("type" Data.Aeson.Types.ToJSON..= priceType obj) GHC.Base.<> (("unit_amount" Data.Aeson.Types.ToJSON..= priceUnitAmount obj) GHC.Base.<> (("unit_amount_decimal" Data.Aeson.Types.ToJSON..= priceUnitAmountDecimal obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "price"))))))))))))))))))) 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..: "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, 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 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' = PriceRecurring' { -- | 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'AggregateUsage :: (GHC.Maybe.Maybe PriceRecurring'AggregateUsage'), -- | interval: The frequency at which a subscription is billed. One of \`day\`, \`week\`, \`month\` or \`year\`. priceRecurring'Interval :: (GHC.Maybe.Maybe PriceRecurring'Interval'), -- | 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'IntervalCount :: (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'UsageType :: (GHC.Maybe.Maybe PriceRecurring'UsageType') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring' where toJSON obj = Data.Aeson.Types.Internal.object ("aggregate_usage" Data.Aeson.Types.ToJSON..= priceRecurring'AggregateUsage obj : "interval" Data.Aeson.Types.ToJSON..= priceRecurring'Interval obj : "interval_count" Data.Aeson.Types.ToJSON..= priceRecurring'IntervalCount obj : "usage_type" Data.Aeson.Types.ToJSON..= priceRecurring'UsageType obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("aggregate_usage" Data.Aeson.Types.ToJSON..= priceRecurring'AggregateUsage obj) GHC.Base.<> (("interval" Data.Aeson.Types.ToJSON..= priceRecurring'Interval obj) GHC.Base.<> (("interval_count" Data.Aeson.Types.ToJSON..= priceRecurring'IntervalCount obj) GHC.Base.<> ("usage_type" Data.Aeson.Types.ToJSON..= priceRecurring'UsageType obj)))) instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PriceRecurring'" (\obj -> (((GHC.Base.pure PriceRecurring' 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'' with all required fields. mkPriceRecurring' :: PriceRecurring' mkPriceRecurring' = PriceRecurring' { priceRecurring'AggregateUsage = GHC.Maybe.Nothing, priceRecurring'Interval = GHC.Maybe.Nothing, priceRecurring'IntervalCount = GHC.Maybe.Nothing, priceRecurring'UsageType = 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'AggregateUsage' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceRecurring'AggregateUsage'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'AggregateUsage'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"last_during_period"@ PriceRecurring'AggregateUsage'EnumLastDuringPeriod | -- | Represents the JSON value @"last_ever"@ PriceRecurring'AggregateUsage'EnumLastEver | -- | Represents the JSON value @"max"@ PriceRecurring'AggregateUsage'EnumMax | -- | Represents the JSON value @"sum"@ PriceRecurring'AggregateUsage'EnumSum deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'AggregateUsage' where toJSON (PriceRecurring'AggregateUsage'Other val) = val toJSON (PriceRecurring'AggregateUsage'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceRecurring'AggregateUsage'EnumLastDuringPeriod) = "last_during_period" toJSON (PriceRecurring'AggregateUsage'EnumLastEver) = "last_ever" toJSON (PriceRecurring'AggregateUsage'EnumMax) = "max" toJSON (PriceRecurring'AggregateUsage'EnumSum) = "sum" instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'AggregateUsage' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "last_during_period" -> PriceRecurring'AggregateUsage'EnumLastDuringPeriod | val GHC.Classes.== "last_ever" -> PriceRecurring'AggregateUsage'EnumLastEver | val GHC.Classes.== "max" -> PriceRecurring'AggregateUsage'EnumMax | val GHC.Classes.== "sum" -> PriceRecurring'AggregateUsage'EnumSum | GHC.Base.otherwise -> PriceRecurring'AggregateUsage'Other 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'Interval' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceRecurring'Interval'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'Interval'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"day"@ PriceRecurring'Interval'EnumDay | -- | Represents the JSON value @"month"@ PriceRecurring'Interval'EnumMonth | -- | Represents the JSON value @"week"@ PriceRecurring'Interval'EnumWeek | -- | Represents the JSON value @"year"@ PriceRecurring'Interval'EnumYear deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'Interval' where toJSON (PriceRecurring'Interval'Other val) = val toJSON (PriceRecurring'Interval'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceRecurring'Interval'EnumDay) = "day" toJSON (PriceRecurring'Interval'EnumMonth) = "month" toJSON (PriceRecurring'Interval'EnumWeek) = "week" toJSON (PriceRecurring'Interval'EnumYear) = "year" instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'Interval' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "day" -> PriceRecurring'Interval'EnumDay | val GHC.Classes.== "month" -> PriceRecurring'Interval'EnumMonth | val GHC.Classes.== "week" -> PriceRecurring'Interval'EnumWeek | val GHC.Classes.== "year" -> PriceRecurring'Interval'EnumYear | GHC.Base.otherwise -> PriceRecurring'Interval'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'UsageType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceRecurring'UsageType'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'UsageType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"licensed"@ PriceRecurring'UsageType'EnumLicensed | -- | Represents the JSON value @"metered"@ PriceRecurring'UsageType'EnumMetered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceRecurring'UsageType' where toJSON (PriceRecurring'UsageType'Other val) = val toJSON (PriceRecurring'UsageType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceRecurring'UsageType'EnumLicensed) = "licensed" toJSON (PriceRecurring'UsageType'EnumMetered) = "metered" instance Data.Aeson.Types.FromJSON.FromJSON PriceRecurring'UsageType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "licensed" -> PriceRecurring'UsageType'EnumLicensed | val GHC.Classes.== "metered" -> PriceRecurring'UsageType'EnumMetered | GHC.Base.otherwise -> PriceRecurring'UsageType'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' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceTaxBehavior'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. PriceTaxBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"exclusive"@ PriceTaxBehavior'EnumExclusive | -- | Represents the JSON value @"inclusive"@ PriceTaxBehavior'EnumInclusive | -- | Represents the JSON value @"unspecified"@ PriceTaxBehavior'EnumUnspecified deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceTaxBehavior' where toJSON (PriceTaxBehavior'Other val) = val toJSON (PriceTaxBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceTaxBehavior'EnumExclusive) = "exclusive" toJSON (PriceTaxBehavior'EnumInclusive) = "inclusive" toJSON (PriceTaxBehavior'EnumUnspecified) = "unspecified" instance Data.Aeson.Types.FromJSON.FromJSON PriceTaxBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "exclusive" -> PriceTaxBehavior'EnumExclusive | val GHC.Classes.== "inclusive" -> PriceTaxBehavior'EnumInclusive | val GHC.Classes.== "unspecified" -> PriceTaxBehavior'EnumUnspecified | GHC.Base.otherwise -> PriceTaxBehavior'Other 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' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceTiersMode'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. PriceTiersMode'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"graduated"@ PriceTiersMode'EnumGraduated | -- | Represents the JSON value @"volume"@ PriceTiersMode'EnumVolume deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceTiersMode' where toJSON (PriceTiersMode'Other val) = val toJSON (PriceTiersMode'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceTiersMode'EnumGraduated) = "graduated" toJSON (PriceTiersMode'EnumVolume) = "volume" instance Data.Aeson.Types.FromJSON.FromJSON PriceTiersMode' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "graduated" -> PriceTiersMode'EnumGraduated | val GHC.Classes.== "volume" -> PriceTiersMode'EnumVolume | GHC.Base.otherwise -> PriceTiersMode'Other 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' = PriceTransformQuantity' { -- | divide_by: Divide usage by this number. priceTransformQuantity'DivideBy :: (GHC.Maybe.Maybe GHC.Types.Int), -- | round: After division, either round the result \`up\` or \`down\`. priceTransformQuantity'Round :: (GHC.Maybe.Maybe PriceTransformQuantity'Round') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON PriceTransformQuantity' where toJSON obj = Data.Aeson.Types.Internal.object ("divide_by" Data.Aeson.Types.ToJSON..= priceTransformQuantity'DivideBy obj : "round" Data.Aeson.Types.ToJSON..= priceTransformQuantity'Round obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("divide_by" Data.Aeson.Types.ToJSON..= priceTransformQuantity'DivideBy obj) GHC.Base.<> ("round" Data.Aeson.Types.ToJSON..= priceTransformQuantity'Round obj)) instance Data.Aeson.Types.FromJSON.FromJSON PriceTransformQuantity' where parseJSON = Data.Aeson.Types.FromJSON.withObject "PriceTransformQuantity'" (\obj -> (GHC.Base.pure PriceTransformQuantity' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "divide_by")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "round")) -- | Create a new 'PriceTransformQuantity'' with all required fields. mkPriceTransformQuantity' :: PriceTransformQuantity' mkPriceTransformQuantity' = PriceTransformQuantity' { priceTransformQuantity'DivideBy = GHC.Maybe.Nothing, priceTransformQuantity'Round = 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'Round' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. PriceTransformQuantity'Round'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'Round'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"down"@ PriceTransformQuantity'Round'EnumDown | -- | Represents the JSON value @"up"@ PriceTransformQuantity'Round'EnumUp deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PriceTransformQuantity'Round' where toJSON (PriceTransformQuantity'Round'Other val) = val toJSON (PriceTransformQuantity'Round'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (PriceTransformQuantity'Round'EnumDown) = "down" toJSON (PriceTransformQuantity'Round'EnumUp) = "up" instance Data.Aeson.Types.FromJSON.FromJSON PriceTransformQuantity'Round' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "down" -> PriceTransformQuantity'Round'EnumDown | val GHC.Classes.== "up" -> PriceTransformQuantity'Round'EnumUp | GHC.Base.otherwise -> PriceTransformQuantity'Round'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 )