{-# 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 Item module StripeAPI.Types.Item 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.LineItemsDiscountAmount import {-# SOURCE #-} StripeAPI.Types.LineItemsTaxAmount import {-# SOURCE #-} StripeAPI.Types.Price 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.item@ in the specification. -- -- A line item. data Item = Item { -- | amount_subtotal: Total before any discounts or taxes are applied. itemAmountSubtotal :: GHC.Types.Int, -- | amount_total: Total after discounts and taxes. itemAmountTotal :: 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). itemCurrency :: Data.Text.Internal.Text, -- | description: An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. -- -- Constraints: -- -- * Maximum length of 5000 itemDescription :: Data.Text.Internal.Text, -- | discounts: The discounts applied to the line item. itemDiscounts :: (GHC.Maybe.Maybe ([LineItemsDiscountAmount])), -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 itemId :: Data.Text.Internal.Text, -- | price: The price used to generate the line item. itemPrice :: (GHC.Maybe.Maybe ItemPrice'), -- | quantity: The quantity of products being purchased. itemQuantity :: (GHC.Maybe.Maybe GHC.Types.Int), -- | taxes: The taxes applied to the line item. itemTaxes :: (GHC.Maybe.Maybe ([LineItemsTaxAmount])) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON Item where toJSON obj = Data.Aeson.Types.Internal.object ("amount_subtotal" Data.Aeson.Types.ToJSON..= itemAmountSubtotal obj : "amount_total" Data.Aeson.Types.ToJSON..= itemAmountTotal obj : "currency" Data.Aeson.Types.ToJSON..= itemCurrency obj : "description" Data.Aeson.Types.ToJSON..= itemDescription obj : "discounts" Data.Aeson.Types.ToJSON..= itemDiscounts obj : "id" Data.Aeson.Types.ToJSON..= itemId obj : "price" Data.Aeson.Types.ToJSON..= itemPrice obj : "quantity" Data.Aeson.Types.ToJSON..= itemQuantity obj : "taxes" Data.Aeson.Types.ToJSON..= itemTaxes obj : "object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "item" : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount_subtotal" Data.Aeson.Types.ToJSON..= itemAmountSubtotal obj) GHC.Base.<> (("amount_total" Data.Aeson.Types.ToJSON..= itemAmountTotal obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= itemCurrency obj) GHC.Base.<> (("description" Data.Aeson.Types.ToJSON..= itemDescription obj) GHC.Base.<> (("discounts" Data.Aeson.Types.ToJSON..= itemDiscounts obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= itemId obj) GHC.Base.<> (("price" Data.Aeson.Types.ToJSON..= itemPrice obj) GHC.Base.<> (("quantity" Data.Aeson.Types.ToJSON..= itemQuantity obj) GHC.Base.<> (("taxes" Data.Aeson.Types.ToJSON..= itemTaxes obj) GHC.Base.<> ("object" Data.Aeson.Types.ToJSON..= Data.Aeson.Types.Internal.String "item")))))))))) instance Data.Aeson.Types.FromJSON.FromJSON Item where parseJSON = Data.Aeson.Types.FromJSON.withObject "Item" (\obj -> ((((((((GHC.Base.pure Item GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount_subtotal")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount_total")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "currency")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "description")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "discounts")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "id")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "price")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "quantity")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "taxes")) -- | Create a new 'Item' with all required fields. mkItem :: -- | 'itemAmountSubtotal' GHC.Types.Int -> -- | 'itemAmountTotal' GHC.Types.Int -> -- | 'itemCurrency' Data.Text.Internal.Text -> -- | 'itemDescription' Data.Text.Internal.Text -> -- | 'itemId' Data.Text.Internal.Text -> Item mkItem itemAmountSubtotal itemAmountTotal itemCurrency itemDescription itemId = Item { itemAmountSubtotal = itemAmountSubtotal, itemAmountTotal = itemAmountTotal, itemCurrency = itemCurrency, itemDescription = itemDescription, itemDiscounts = GHC.Maybe.Nothing, itemId = itemId, itemPrice = GHC.Maybe.Nothing, itemQuantity = GHC.Maybe.Nothing, itemTaxes = GHC.Maybe.Nothing } -- | Defines the object schema located at @components.schemas.item.properties.price.anyOf@ in the specification. -- -- The price used to generate the line item. data ItemPrice' = ItemPrice' { -- | active: Whether the price can be used for new purchases. itemPrice'Active :: (GHC.Maybe.Maybe 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. itemPrice'BillingScheme :: (GHC.Maybe.Maybe ItemPrice'BillingScheme'), -- | created: Time at which the object was created. Measured in seconds since the Unix epoch. itemPrice'Created :: (GHC.Maybe.Maybe 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). itemPrice'Currency :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | id: Unique identifier for the object. -- -- Constraints: -- -- * Maximum length of 5000 itemPrice'Id :: (GHC.Maybe.Maybe 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. itemPrice'Livemode :: (GHC.Maybe.Maybe GHC.Types.Bool), -- | lookup_key: A lookup key used to retrieve prices dynamically from a static string. -- -- Constraints: -- -- * Maximum length of 5000 itemPrice'LookupKey :: (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. itemPrice'Metadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object), -- | nickname: A brief description of the price, hidden from customers. -- -- Constraints: -- -- * Maximum length of 5000 itemPrice'Nickname :: (GHC.Maybe.Maybe Data.Text.Internal.Text), -- | object: String representing the object\'s type. Objects of the same type share the same value. itemPrice'Object :: (GHC.Maybe.Maybe ItemPrice'Object'), -- | product: The ID of the product this price is associated with. itemPrice'Product :: (GHC.Maybe.Maybe ItemPrice'Product'Variants), -- | recurring: The recurring components of a price such as \`interval\` and \`usage_type\`. itemPrice'Recurring :: (GHC.Maybe.Maybe ItemPrice'Recurring'), -- | 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. itemPrice'TaxBehavior :: (GHC.Maybe.Maybe ItemPrice'TaxBehavior'), -- | tiers: Each element represents a pricing tier. This parameter requires \`billing_scheme\` to be set to \`tiered\`. See also the documentation for \`billing_scheme\`. itemPrice'Tiers :: (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. itemPrice'TiersMode :: (GHC.Maybe.Maybe ItemPrice'TiersMode'), -- | transform_quantity: Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with \`tiers\`. itemPrice'TransformQuantity :: (GHC.Maybe.Maybe ItemPrice'TransformQuantity'), -- | type: One of \`one_time\` or \`recurring\` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. itemPrice'Type :: (GHC.Maybe.Maybe ItemPrice'Type'), -- | unit_amount: The unit amount in %s to be charged, represented as a whole integer if possible. Only set if \`billing_scheme=per_unit\`. itemPrice'UnitAmount :: (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\`. itemPrice'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice' where toJSON obj = Data.Aeson.Types.Internal.object ("active" Data.Aeson.Types.ToJSON..= itemPrice'Active obj : "billing_scheme" Data.Aeson.Types.ToJSON..= itemPrice'BillingScheme obj : "created" Data.Aeson.Types.ToJSON..= itemPrice'Created obj : "currency" Data.Aeson.Types.ToJSON..= itemPrice'Currency obj : "id" Data.Aeson.Types.ToJSON..= itemPrice'Id obj : "livemode" Data.Aeson.Types.ToJSON..= itemPrice'Livemode obj : "lookup_key" Data.Aeson.Types.ToJSON..= itemPrice'LookupKey obj : "metadata" Data.Aeson.Types.ToJSON..= itemPrice'Metadata obj : "nickname" Data.Aeson.Types.ToJSON..= itemPrice'Nickname obj : "object" Data.Aeson.Types.ToJSON..= itemPrice'Object obj : "product" Data.Aeson.Types.ToJSON..= itemPrice'Product obj : "recurring" Data.Aeson.Types.ToJSON..= itemPrice'Recurring obj : "tax_behavior" Data.Aeson.Types.ToJSON..= itemPrice'TaxBehavior obj : "tiers" Data.Aeson.Types.ToJSON..= itemPrice'Tiers obj : "tiers_mode" Data.Aeson.Types.ToJSON..= itemPrice'TiersMode obj : "transform_quantity" Data.Aeson.Types.ToJSON..= itemPrice'TransformQuantity obj : "type" Data.Aeson.Types.ToJSON..= itemPrice'Type obj : "unit_amount" Data.Aeson.Types.ToJSON..= itemPrice'UnitAmount obj : "unit_amount_decimal" Data.Aeson.Types.ToJSON..= itemPrice'UnitAmountDecimal obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("active" Data.Aeson.Types.ToJSON..= itemPrice'Active obj) GHC.Base.<> (("billing_scheme" Data.Aeson.Types.ToJSON..= itemPrice'BillingScheme obj) GHC.Base.<> (("created" Data.Aeson.Types.ToJSON..= itemPrice'Created obj) GHC.Base.<> (("currency" Data.Aeson.Types.ToJSON..= itemPrice'Currency obj) GHC.Base.<> (("id" Data.Aeson.Types.ToJSON..= itemPrice'Id obj) GHC.Base.<> (("livemode" Data.Aeson.Types.ToJSON..= itemPrice'Livemode obj) GHC.Base.<> (("lookup_key" Data.Aeson.Types.ToJSON..= itemPrice'LookupKey obj) GHC.Base.<> (("metadata" Data.Aeson.Types.ToJSON..= itemPrice'Metadata obj) GHC.Base.<> (("nickname" Data.Aeson.Types.ToJSON..= itemPrice'Nickname obj) GHC.Base.<> (("object" Data.Aeson.Types.ToJSON..= itemPrice'Object obj) GHC.Base.<> (("product" Data.Aeson.Types.ToJSON..= itemPrice'Product obj) GHC.Base.<> (("recurring" Data.Aeson.Types.ToJSON..= itemPrice'Recurring obj) GHC.Base.<> (("tax_behavior" Data.Aeson.Types.ToJSON..= itemPrice'TaxBehavior obj) GHC.Base.<> (("tiers" Data.Aeson.Types.ToJSON..= itemPrice'Tiers obj) GHC.Base.<> (("tiers_mode" Data.Aeson.Types.ToJSON..= itemPrice'TiersMode obj) GHC.Base.<> (("transform_quantity" Data.Aeson.Types.ToJSON..= itemPrice'TransformQuantity obj) GHC.Base.<> (("type" Data.Aeson.Types.ToJSON..= itemPrice'Type obj) GHC.Base.<> (("unit_amount" Data.Aeson.Types.ToJSON..= itemPrice'UnitAmount obj) GHC.Base.<> ("unit_amount_decimal" Data.Aeson.Types.ToJSON..= itemPrice'UnitAmountDecimal obj))))))))))))))))))) instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice' where parseJSON = Data.Aeson.Types.FromJSON.withObject "ItemPrice'" (\obj -> ((((((((((((((((((GHC.Base.pure ItemPrice' 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..:? "object")) 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 'ItemPrice'' with all required fields. mkItemPrice' :: ItemPrice' mkItemPrice' = ItemPrice' { itemPrice'Active = GHC.Maybe.Nothing, itemPrice'BillingScheme = GHC.Maybe.Nothing, itemPrice'Created = GHC.Maybe.Nothing, itemPrice'Currency = GHC.Maybe.Nothing, itemPrice'Id = GHC.Maybe.Nothing, itemPrice'Livemode = GHC.Maybe.Nothing, itemPrice'LookupKey = GHC.Maybe.Nothing, itemPrice'Metadata = GHC.Maybe.Nothing, itemPrice'Nickname = GHC.Maybe.Nothing, itemPrice'Object = GHC.Maybe.Nothing, itemPrice'Product = GHC.Maybe.Nothing, itemPrice'Recurring = GHC.Maybe.Nothing, itemPrice'TaxBehavior = GHC.Maybe.Nothing, itemPrice'Tiers = GHC.Maybe.Nothing, itemPrice'TiersMode = GHC.Maybe.Nothing, itemPrice'TransformQuantity = GHC.Maybe.Nothing, itemPrice'Type = GHC.Maybe.Nothing, itemPrice'UnitAmount = GHC.Maybe.Nothing, itemPrice'UnitAmountDecimal = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'BillingScheme' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'BillingScheme'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. ItemPrice'BillingScheme'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"per_unit"@ ItemPrice'BillingScheme'EnumPerUnit | -- | Represents the JSON value @"tiered"@ ItemPrice'BillingScheme'EnumTiered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'BillingScheme' where toJSON (ItemPrice'BillingScheme'Other val) = val toJSON (ItemPrice'BillingScheme'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'BillingScheme'EnumPerUnit) = "per_unit" toJSON (ItemPrice'BillingScheme'EnumTiered) = "tiered" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'BillingScheme' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "per_unit" -> ItemPrice'BillingScheme'EnumPerUnit | val GHC.Classes.== "tiered" -> ItemPrice'BillingScheme'EnumTiered | GHC.Base.otherwise -> ItemPrice'BillingScheme'Other val ) -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.properties.object@ in the specification. -- -- String representing the object\'s type. Objects of the same type share the same value. data ItemPrice'Object' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'Object'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. ItemPrice'Object'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"price"@ ItemPrice'Object'EnumPrice deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Object' where toJSON (ItemPrice'Object'Other val) = val toJSON (ItemPrice'Object'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'Object'EnumPrice) = "price" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Object' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "price" -> ItemPrice'Object'EnumPrice | GHC.Base.otherwise -> ItemPrice'Object'Other val ) -- | Defines the oneOf schema located at @components.schemas.item.properties.price.anyOf.properties.product.anyOf@ in the specification. -- -- The ID of the product this price is associated with. data ItemPrice'Product'Variants = ItemPrice'Product'Text Data.Text.Internal.Text | ItemPrice'Product'Product Product | ItemPrice'Product'DeletedProduct DeletedProduct deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Product'Variants where toJSON (ItemPrice'Product'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (ItemPrice'Product'Product a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (ItemPrice'Product'DeletedProduct a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Product'Variants where parseJSON val = case (ItemPrice'Product'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((ItemPrice'Product'Product Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((ItemPrice'Product'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.item.properties.price.anyOf.properties.recurring.anyOf@ in the specification. -- -- The recurring components of a price such as \\\`interval\\\` and \\\`usage_type\\\`. data ItemPrice'Recurring' = ItemPrice'Recurring' { -- | 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\`. itemPrice'Recurring'AggregateUsage :: (GHC.Maybe.Maybe ItemPrice'Recurring'AggregateUsage'), -- | interval: The frequency at which a subscription is billed. One of \`day\`, \`week\`, \`month\` or \`year\`. itemPrice'Recurring'Interval :: (GHC.Maybe.Maybe ItemPrice'Recurring'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. itemPrice'Recurring'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\`. itemPrice'Recurring'UsageType :: (GHC.Maybe.Maybe ItemPrice'Recurring'UsageType') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring' where toJSON obj = Data.Aeson.Types.Internal.object ("aggregate_usage" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'AggregateUsage obj : "interval" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'Interval obj : "interval_count" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'IntervalCount obj : "usage_type" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'UsageType obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("aggregate_usage" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'AggregateUsage obj) GHC.Base.<> (("interval" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'Interval obj) GHC.Base.<> (("interval_count" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'IntervalCount obj) GHC.Base.<> ("usage_type" Data.Aeson.Types.ToJSON..= itemPrice'Recurring'UsageType obj)))) instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring' where parseJSON = Data.Aeson.Types.FromJSON.withObject "ItemPrice'Recurring'" (\obj -> (((GHC.Base.pure ItemPrice'Recurring' 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 'ItemPrice'Recurring'' with all required fields. mkItemPrice'Recurring' :: ItemPrice'Recurring' mkItemPrice'Recurring' = ItemPrice'Recurring' { itemPrice'Recurring'AggregateUsage = GHC.Maybe.Nothing, itemPrice'Recurring'Interval = GHC.Maybe.Nothing, itemPrice'Recurring'IntervalCount = GHC.Maybe.Nothing, itemPrice'Recurring'UsageType = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'Recurring'AggregateUsage' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'Recurring'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. ItemPrice'Recurring'AggregateUsage'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"last_during_period"@ ItemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod | -- | Represents the JSON value @"last_ever"@ ItemPrice'Recurring'AggregateUsage'EnumLastEver | -- | Represents the JSON value @"max"@ ItemPrice'Recurring'AggregateUsage'EnumMax | -- | Represents the JSON value @"sum"@ ItemPrice'Recurring'AggregateUsage'EnumSum deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring'AggregateUsage' where toJSON (ItemPrice'Recurring'AggregateUsage'Other val) = val toJSON (ItemPrice'Recurring'AggregateUsage'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod) = "last_during_period" toJSON (ItemPrice'Recurring'AggregateUsage'EnumLastEver) = "last_ever" toJSON (ItemPrice'Recurring'AggregateUsage'EnumMax) = "max" toJSON (ItemPrice'Recurring'AggregateUsage'EnumSum) = "sum" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring'AggregateUsage' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "last_during_period" -> ItemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod | val GHC.Classes.== "last_ever" -> ItemPrice'Recurring'AggregateUsage'EnumLastEver | val GHC.Classes.== "max" -> ItemPrice'Recurring'AggregateUsage'EnumMax | val GHC.Classes.== "sum" -> ItemPrice'Recurring'AggregateUsage'EnumSum | GHC.Base.otherwise -> ItemPrice'Recurring'AggregateUsage'Other val ) -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.properties.recurring.anyOf.properties.interval@ in the specification. -- -- The frequency at which a subscription is billed. One of \`day\`, \`week\`, \`month\` or \`year\`. data ItemPrice'Recurring'Interval' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'Recurring'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. ItemPrice'Recurring'Interval'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"day"@ ItemPrice'Recurring'Interval'EnumDay | -- | Represents the JSON value @"month"@ ItemPrice'Recurring'Interval'EnumMonth | -- | Represents the JSON value @"week"@ ItemPrice'Recurring'Interval'EnumWeek | -- | Represents the JSON value @"year"@ ItemPrice'Recurring'Interval'EnumYear deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring'Interval' where toJSON (ItemPrice'Recurring'Interval'Other val) = val toJSON (ItemPrice'Recurring'Interval'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'Recurring'Interval'EnumDay) = "day" toJSON (ItemPrice'Recurring'Interval'EnumMonth) = "month" toJSON (ItemPrice'Recurring'Interval'EnumWeek) = "week" toJSON (ItemPrice'Recurring'Interval'EnumYear) = "year" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring'Interval' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "day" -> ItemPrice'Recurring'Interval'EnumDay | val GHC.Classes.== "month" -> ItemPrice'Recurring'Interval'EnumMonth | val GHC.Classes.== "week" -> ItemPrice'Recurring'Interval'EnumWeek | val GHC.Classes.== "year" -> ItemPrice'Recurring'Interval'EnumYear | GHC.Base.otherwise -> ItemPrice'Recurring'Interval'Other val ) -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'Recurring'UsageType' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'Recurring'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. ItemPrice'Recurring'UsageType'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"licensed"@ ItemPrice'Recurring'UsageType'EnumLicensed | -- | Represents the JSON value @"metered"@ ItemPrice'Recurring'UsageType'EnumMetered deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring'UsageType' where toJSON (ItemPrice'Recurring'UsageType'Other val) = val toJSON (ItemPrice'Recurring'UsageType'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'Recurring'UsageType'EnumLicensed) = "licensed" toJSON (ItemPrice'Recurring'UsageType'EnumMetered) = "metered" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring'UsageType' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "licensed" -> ItemPrice'Recurring'UsageType'EnumLicensed | val GHC.Classes.== "metered" -> ItemPrice'Recurring'UsageType'EnumMetered | GHC.Base.otherwise -> ItemPrice'Recurring'UsageType'Other val ) -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'TaxBehavior' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'TaxBehavior'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. ItemPrice'TaxBehavior'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"exclusive"@ ItemPrice'TaxBehavior'EnumExclusive | -- | Represents the JSON value @"inclusive"@ ItemPrice'TaxBehavior'EnumInclusive | -- | Represents the JSON value @"unspecified"@ ItemPrice'TaxBehavior'EnumUnspecified deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TaxBehavior' where toJSON (ItemPrice'TaxBehavior'Other val) = val toJSON (ItemPrice'TaxBehavior'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'TaxBehavior'EnumExclusive) = "exclusive" toJSON (ItemPrice'TaxBehavior'EnumInclusive) = "inclusive" toJSON (ItemPrice'TaxBehavior'EnumUnspecified) = "unspecified" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TaxBehavior' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "exclusive" -> ItemPrice'TaxBehavior'EnumExclusive | val GHC.Classes.== "inclusive" -> ItemPrice'TaxBehavior'EnumInclusive | val GHC.Classes.== "unspecified" -> ItemPrice'TaxBehavior'EnumUnspecified | GHC.Base.otherwise -> ItemPrice'TaxBehavior'Other val ) -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'TiersMode' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'TiersMode'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. ItemPrice'TiersMode'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"graduated"@ ItemPrice'TiersMode'EnumGraduated | -- | Represents the JSON value @"volume"@ ItemPrice'TiersMode'EnumVolume deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TiersMode' where toJSON (ItemPrice'TiersMode'Other val) = val toJSON (ItemPrice'TiersMode'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'TiersMode'EnumGraduated) = "graduated" toJSON (ItemPrice'TiersMode'EnumVolume) = "volume" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TiersMode' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "graduated" -> ItemPrice'TiersMode'EnumGraduated | val GHC.Classes.== "volume" -> ItemPrice'TiersMode'EnumVolume | GHC.Base.otherwise -> ItemPrice'TiersMode'Other val ) -- | Defines the object schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'TransformQuantity' = ItemPrice'TransformQuantity' { -- | divide_by: Divide usage by this number. itemPrice'TransformQuantity'DivideBy :: (GHC.Maybe.Maybe GHC.Types.Int), -- | round: After division, either round the result \`up\` or \`down\`. itemPrice'TransformQuantity'Round :: (GHC.Maybe.Maybe ItemPrice'TransformQuantity'Round') } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TransformQuantity' where toJSON obj = Data.Aeson.Types.Internal.object ("divide_by" Data.Aeson.Types.ToJSON..= itemPrice'TransformQuantity'DivideBy obj : "round" Data.Aeson.Types.ToJSON..= itemPrice'TransformQuantity'Round obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("divide_by" Data.Aeson.Types.ToJSON..= itemPrice'TransformQuantity'DivideBy obj) GHC.Base.<> ("round" Data.Aeson.Types.ToJSON..= itemPrice'TransformQuantity'Round obj)) instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TransformQuantity' where parseJSON = Data.Aeson.Types.FromJSON.withObject "ItemPrice'TransformQuantity'" (\obj -> (GHC.Base.pure ItemPrice'TransformQuantity' GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "divide_by")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "round")) -- | Create a new 'ItemPrice'TransformQuantity'' with all required fields. mkItemPrice'TransformQuantity' :: ItemPrice'TransformQuantity' mkItemPrice'TransformQuantity' = ItemPrice'TransformQuantity' { itemPrice'TransformQuantity'DivideBy = GHC.Maybe.Nothing, itemPrice'TransformQuantity'Round = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.properties.transform_quantity.anyOf.properties.round@ in the specification. -- -- After division, either round the result \`up\` or \`down\`. data ItemPrice'TransformQuantity'Round' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'TransformQuantity'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. ItemPrice'TransformQuantity'Round'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"down"@ ItemPrice'TransformQuantity'Round'EnumDown | -- | Represents the JSON value @"up"@ ItemPrice'TransformQuantity'Round'EnumUp deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TransformQuantity'Round' where toJSON (ItemPrice'TransformQuantity'Round'Other val) = val toJSON (ItemPrice'TransformQuantity'Round'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'TransformQuantity'Round'EnumDown) = "down" toJSON (ItemPrice'TransformQuantity'Round'EnumUp) = "up" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TransformQuantity'Round' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "down" -> ItemPrice'TransformQuantity'Round'EnumDown | val GHC.Classes.== "up" -> ItemPrice'TransformQuantity'Round'EnumUp | GHC.Base.otherwise -> ItemPrice'TransformQuantity'Round'Other val ) -- | Defines the enum schema located at @components.schemas.item.properties.price.anyOf.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 ItemPrice'Type' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. ItemPrice'Type'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. ItemPrice'Type'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"one_time"@ ItemPrice'Type'EnumOneTime | -- | Represents the JSON value @"recurring"@ ItemPrice'Type'EnumRecurring deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Type' where toJSON (ItemPrice'Type'Other val) = val toJSON (ItemPrice'Type'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (ItemPrice'Type'EnumOneTime) = "one_time" toJSON (ItemPrice'Type'EnumRecurring) = "recurring" instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Type' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "one_time" -> ItemPrice'Type'EnumOneTime | val GHC.Classes.== "recurring" -> ItemPrice'Type'EnumRecurring | GHC.Base.otherwise -> ItemPrice'Type'Other val )