{-# 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.
    Item -> Int
itemAmountSubtotal :: GHC.Types.Int,
    -- | amount_total: Total after discounts and taxes.
    Item -> Int
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).
    Item -> Text
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
    Item -> Text
itemDescription :: Data.Text.Internal.Text,
    -- | discounts: The discounts applied to the line item.
    Item -> Maybe [LineItemsDiscountAmount]
itemDiscounts :: (GHC.Maybe.Maybe ([LineItemsDiscountAmount])),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Item -> Text
itemId :: Data.Text.Internal.Text,
    -- | price: The price used to generate the line item.
    Item -> Maybe ItemPrice'
itemPrice :: (GHC.Maybe.Maybe ItemPrice'),
    -- | quantity: The quantity of products being purchased.
    Item -> Maybe Int
itemQuantity :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | taxes: The taxes applied to the line item.
    Item -> Maybe [LineItemsTaxAmount]
itemTaxes :: (GHC.Maybe.Maybe ([LineItemsTaxAmount]))
  }
  deriving
    ( Int -> Item -> ShowS
[Item] -> ShowS
Item -> String
(Int -> Item -> ShowS)
-> (Item -> String) -> ([Item] -> ShowS) -> Show Item
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Item] -> ShowS
$cshowList :: [Item] -> ShowS
show :: Item -> String
$cshow :: Item -> String
showsPrec :: Int -> Item -> ShowS
$cshowsPrec :: Int -> Item -> ShowS
GHC.Show.Show,
      Item -> Item -> Bool
(Item -> Item -> Bool) -> (Item -> Item -> Bool) -> Eq Item
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Item -> Item -> Bool
$c/= :: Item -> Item -> Bool
== :: Item -> Item -> Bool
$c== :: Item -> Item -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON Item where
  toJSON :: Item -> Value
toJSON Item
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount_subtotal" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Int
itemAmountSubtotal Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"amount_total" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Int
itemAmountTotal Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Text
itemCurrency Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Text
itemDescription Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discounts" Text -> Maybe [LineItemsDiscountAmount] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe [LineItemsDiscountAmount]
itemDiscounts Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Text
itemId Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"price" Text -> Maybe ItemPrice' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe ItemPrice'
itemPrice Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"quantity" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe Int
itemQuantity Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"taxes" Text -> Maybe [LineItemsTaxAmount] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe [LineItemsTaxAmount]
itemTaxes Item
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"item" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: Item -> Encoding
toEncoding Item
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount_subtotal" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Int
itemAmountSubtotal Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"amount_total" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Int
itemAmountTotal Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Text
itemCurrency Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Text
itemDescription Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discounts" Text -> Maybe [LineItemsDiscountAmount] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe [LineItemsDiscountAmount]
itemDiscounts Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Text
itemId Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"price" Text -> Maybe ItemPrice' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe ItemPrice'
itemPrice Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"quantity" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe Int
itemQuantity Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"taxes" Text -> Maybe [LineItemsTaxAmount] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Item -> Maybe [LineItemsTaxAmount]
itemTaxes Item
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"item"))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON Item where
  parseJSON :: Value -> Parser Item
parseJSON = String -> (Object -> Parser Item) -> Value -> Parser Item
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Item" (\Object
obj -> (((((((((Int
 -> Int
 -> Text
 -> Text
 -> Maybe [LineItemsDiscountAmount]
 -> Text
 -> Maybe ItemPrice'
 -> Maybe Int
 -> Maybe [LineItemsTaxAmount]
 -> Item)
-> Parser
     (Int
      -> Int
      -> Text
      -> Text
      -> Maybe [LineItemsDiscountAmount]
      -> Text
      -> Maybe ItemPrice'
      -> Maybe Int
      -> Maybe [LineItemsTaxAmount]
      -> Item)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Int
-> Text
-> Text
-> Maybe [LineItemsDiscountAmount]
-> Text
-> Maybe ItemPrice'
-> Maybe Int
-> Maybe [LineItemsTaxAmount]
-> Item
Item Parser
  (Int
   -> Int
   -> Text
   -> Text
   -> Maybe [LineItemsDiscountAmount]
   -> Text
   -> Maybe ItemPrice'
   -> Maybe Int
   -> Maybe [LineItemsTaxAmount]
   -> Item)
-> Parser Int
-> Parser
     (Int
      -> Text
      -> Text
      -> Maybe [LineItemsDiscountAmount]
      -> Text
      -> Maybe ItemPrice'
      -> Maybe Int
      -> Maybe [LineItemsTaxAmount]
      -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"amount_subtotal")) Parser
  (Int
   -> Text
   -> Text
   -> Maybe [LineItemsDiscountAmount]
   -> Text
   -> Maybe ItemPrice'
   -> Maybe Int
   -> Maybe [LineItemsTaxAmount]
   -> Item)
-> Parser Int
-> Parser
     (Text
      -> Text
      -> Maybe [LineItemsDiscountAmount]
      -> Text
      -> Maybe ItemPrice'
      -> Maybe Int
      -> Maybe [LineItemsTaxAmount]
      -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"amount_total")) Parser
  (Text
   -> Text
   -> Maybe [LineItemsDiscountAmount]
   -> Text
   -> Maybe ItemPrice'
   -> Maybe Int
   -> Maybe [LineItemsTaxAmount]
   -> Item)
-> Parser Text
-> Parser
     (Text
      -> Maybe [LineItemsDiscountAmount]
      -> Text
      -> Maybe ItemPrice'
      -> Maybe Int
      -> Maybe [LineItemsTaxAmount]
      -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"currency")) Parser
  (Text
   -> Maybe [LineItemsDiscountAmount]
   -> Text
   -> Maybe ItemPrice'
   -> Maybe Int
   -> Maybe [LineItemsTaxAmount]
   -> Item)
-> Parser Text
-> Parser
     (Maybe [LineItemsDiscountAmount]
      -> Text
      -> Maybe ItemPrice'
      -> Maybe Int
      -> Maybe [LineItemsTaxAmount]
      -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"description")) Parser
  (Maybe [LineItemsDiscountAmount]
   -> Text
   -> Maybe ItemPrice'
   -> Maybe Int
   -> Maybe [LineItemsTaxAmount]
   -> Item)
-> Parser (Maybe [LineItemsDiscountAmount])
-> Parser
     (Text
      -> Maybe ItemPrice'
      -> Maybe Int
      -> Maybe [LineItemsTaxAmount]
      -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [LineItemsDiscountAmount])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"discounts")) Parser
  (Text
   -> Maybe ItemPrice'
   -> Maybe Int
   -> Maybe [LineItemsTaxAmount]
   -> Item)
-> Parser Text
-> Parser
     (Maybe ItemPrice'
      -> Maybe Int -> Maybe [LineItemsTaxAmount] -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"id")) Parser
  (Maybe ItemPrice'
   -> Maybe Int -> Maybe [LineItemsTaxAmount] -> Item)
-> Parser (Maybe ItemPrice')
-> Parser (Maybe Int -> Maybe [LineItemsTaxAmount] -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"price")) Parser (Maybe Int -> Maybe [LineItemsTaxAmount] -> Item)
-> Parser (Maybe Int)
-> Parser (Maybe [LineItemsTaxAmount] -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"quantity")) Parser (Maybe [LineItemsTaxAmount] -> Item)
-> Parser (Maybe [LineItemsTaxAmount]) -> Parser Item
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [LineItemsTaxAmount])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"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 :: Int -> Int -> Text -> Text -> Text -> Item
mkItem Int
itemAmountSubtotal Int
itemAmountTotal Text
itemCurrency Text
itemDescription Text
itemId =
  Item :: Int
-> Int
-> Text
-> Text
-> Maybe [LineItemsDiscountAmount]
-> Text
-> Maybe ItemPrice'
-> Maybe Int
-> Maybe [LineItemsTaxAmount]
-> Item
Item
    { itemAmountSubtotal :: Int
itemAmountSubtotal = Int
itemAmountSubtotal,
      itemAmountTotal :: Int
itemAmountTotal = Int
itemAmountTotal,
      itemCurrency :: Text
itemCurrency = Text
itemCurrency,
      itemDescription :: Text
itemDescription = Text
itemDescription,
      itemDiscounts :: Maybe [LineItemsDiscountAmount]
itemDiscounts = Maybe [LineItemsDiscountAmount]
forall a. Maybe a
GHC.Maybe.Nothing,
      itemId :: Text
itemId = Text
itemId,
      itemPrice :: Maybe ItemPrice'
itemPrice = Maybe ItemPrice'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemQuantity :: Maybe Int
itemQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      itemTaxes :: Maybe [LineItemsTaxAmount]
itemTaxes = Maybe [LineItemsTaxAmount]
forall a. Maybe a
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' -> Maybe Bool
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' -> Maybe ItemPrice'BillingScheme'
itemPrice'BillingScheme :: (GHC.Maybe.Maybe ItemPrice'BillingScheme'),
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    ItemPrice' -> Maybe Int
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' -> Maybe Text
itemPrice'Currency :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    ItemPrice' -> Maybe Text
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' -> Maybe Bool
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' -> Maybe Text
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' -> Maybe Object
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' -> Maybe Text
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' -> Maybe ItemPrice'Object'
itemPrice'Object :: (GHC.Maybe.Maybe ItemPrice'Object'),
    -- | product: The ID of the product this price is associated with.
    ItemPrice' -> Maybe ItemPrice'Product'Variants
itemPrice'Product :: (GHC.Maybe.Maybe ItemPrice'Product'Variants),
    -- | recurring: The recurring components of a price such as \`interval\` and \`usage_type\`.
    ItemPrice' -> Maybe ItemPrice'Recurring'
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' -> Maybe ItemPrice'TaxBehavior'
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' -> Maybe [PriceTier]
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' -> Maybe ItemPrice'TiersMode'
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' -> Maybe ItemPrice'TransformQuantity'
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' -> Maybe ItemPrice'Type'
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' -> Maybe Int
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' -> Maybe Text
itemPrice'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> ItemPrice' -> ShowS
[ItemPrice'] -> ShowS
ItemPrice' -> String
(Int -> ItemPrice' -> ShowS)
-> (ItemPrice' -> String)
-> ([ItemPrice'] -> ShowS)
-> Show ItemPrice'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'] -> ShowS
$cshowList :: [ItemPrice'] -> ShowS
show :: ItemPrice' -> String
$cshow :: ItemPrice' -> String
showsPrec :: Int -> ItemPrice' -> ShowS
$cshowsPrec :: Int -> ItemPrice' -> ShowS
GHC.Show.Show,
      ItemPrice' -> ItemPrice' -> Bool
(ItemPrice' -> ItemPrice' -> Bool)
-> (ItemPrice' -> ItemPrice' -> Bool) -> Eq ItemPrice'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice' -> ItemPrice' -> Bool
$c/= :: ItemPrice' -> ItemPrice' -> Bool
== :: ItemPrice' -> ItemPrice' -> Bool
$c== :: ItemPrice' -> ItemPrice' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice' where
  toJSON :: ItemPrice' -> Value
toJSON ItemPrice'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"active" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Bool
itemPrice'Active ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"billing_scheme" Text -> Maybe ItemPrice'BillingScheme' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'BillingScheme'
itemPrice'BillingScheme ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Int
itemPrice'Created ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"currency" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'Currency ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'Id ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Bool
itemPrice'Livemode ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"lookup_key" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'LookupKey ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Object
itemPrice'Metadata ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"nickname" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'Nickname ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Maybe ItemPrice'Object' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Object'
itemPrice'Object ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"product" Text -> Maybe ItemPrice'Product'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Product'Variants
itemPrice'Product ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"recurring" Text -> Maybe ItemPrice'Recurring' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Recurring'
itemPrice'Recurring ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_behavior" Text -> Maybe ItemPrice'TaxBehavior' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'TaxBehavior'
itemPrice'TaxBehavior ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tiers" Text -> Maybe [PriceTier] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe [PriceTier]
itemPrice'Tiers ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tiers_mode" Text -> Maybe ItemPrice'TiersMode' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'TiersMode'
itemPrice'TiersMode ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"transform_quantity" Text -> Maybe ItemPrice'TransformQuantity' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'TransformQuantity'
itemPrice'TransformQuantity ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> Maybe ItemPrice'Type' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Type'
itemPrice'Type ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Int
itemPrice'UnitAmount ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_amount_decimal" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'UnitAmountDecimal ItemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: ItemPrice' -> Encoding
toEncoding ItemPrice'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"active" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Bool
itemPrice'Active ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"billing_scheme" Text -> Maybe ItemPrice'BillingScheme' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'BillingScheme'
itemPrice'BillingScheme ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Int
itemPrice'Created ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"currency" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'Currency ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'Id ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Bool
itemPrice'Livemode ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"lookup_key" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'LookupKey ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Object
itemPrice'Metadata ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"nickname" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'Nickname ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"object" Text -> Maybe ItemPrice'Object' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Object'
itemPrice'Object ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"product" Text -> Maybe ItemPrice'Product'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Product'Variants
itemPrice'Product ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"recurring" Text -> Maybe ItemPrice'Recurring' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Recurring'
itemPrice'Recurring ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_behavior" Text -> Maybe ItemPrice'TaxBehavior' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'TaxBehavior'
itemPrice'TaxBehavior ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tiers" Text -> Maybe [PriceTier] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe [PriceTier]
itemPrice'Tiers ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tiers_mode" Text -> Maybe ItemPrice'TiersMode' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'TiersMode'
itemPrice'TiersMode ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"transform_quantity" Text -> Maybe ItemPrice'TransformQuantity' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'TransformQuantity'
itemPrice'TransformQuantity ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> Maybe ItemPrice'Type' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe ItemPrice'Type'
itemPrice'Type ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_amount" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Int
itemPrice'UnitAmount ItemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"unit_amount_decimal" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice' -> Maybe Text
itemPrice'UnitAmountDecimal ItemPrice'
obj)))))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice' where
  parseJSON :: Value -> Parser ItemPrice'
parseJSON = String
-> (Object -> Parser ItemPrice') -> Value -> Parser ItemPrice'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ItemPrice'" (\Object
obj -> (((((((((((((((((((Maybe Bool
 -> Maybe ItemPrice'BillingScheme'
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Object
 -> Maybe Text
 -> Maybe ItemPrice'Object'
 -> Maybe ItemPrice'Product'Variants
 -> Maybe ItemPrice'Recurring'
 -> Maybe ItemPrice'TaxBehavior'
 -> Maybe [PriceTier]
 -> Maybe ItemPrice'TiersMode'
 -> Maybe ItemPrice'TransformQuantity'
 -> Maybe ItemPrice'Type'
 -> Maybe Int
 -> Maybe Text
 -> ItemPrice')
-> Parser
     (Maybe Bool
      -> Maybe ItemPrice'BillingScheme'
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe ItemPrice'BillingScheme'
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Object
-> Maybe Text
-> Maybe ItemPrice'Object'
-> Maybe ItemPrice'Product'Variants
-> Maybe ItemPrice'Recurring'
-> Maybe ItemPrice'TaxBehavior'
-> Maybe [PriceTier]
-> Maybe ItemPrice'TiersMode'
-> Maybe ItemPrice'TransformQuantity'
-> Maybe ItemPrice'Type'
-> Maybe Int
-> Maybe Text
-> ItemPrice'
ItemPrice' Parser
  (Maybe Bool
   -> Maybe ItemPrice'BillingScheme'
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Bool)
-> Parser
     (Maybe ItemPrice'BillingScheme'
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"active")) Parser
  (Maybe ItemPrice'BillingScheme'
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe ItemPrice'BillingScheme')
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'BillingScheme')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"billing_scheme")) Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"created")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"currency")) Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"id")) Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"livemode")) Parser
  (Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe Object
      -> Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"lookup_key")) Parser
  (Maybe Object
   -> Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Object)
-> Parser
     (Maybe Text
      -> Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Object)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
  (Maybe Text
   -> Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe ItemPrice'Object'
      -> Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"nickname")) Parser
  (Maybe ItemPrice'Object'
   -> Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe ItemPrice'Object')
-> Parser
     (Maybe ItemPrice'Product'Variants
      -> Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'Object')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"object")) Parser
  (Maybe ItemPrice'Product'Variants
   -> Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe ItemPrice'Product'Variants)
-> Parser
     (Maybe ItemPrice'Recurring'
      -> Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'Product'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"product")) Parser
  (Maybe ItemPrice'Recurring'
   -> Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe ItemPrice'Recurring')
-> Parser
     (Maybe ItemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'Recurring')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"recurring")) Parser
  (Maybe ItemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe ItemPrice'TaxBehavior')
-> Parser
     (Maybe [PriceTier]
      -> Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'TaxBehavior')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_behavior")) Parser
  (Maybe [PriceTier]
   -> Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe [PriceTier])
-> Parser
     (Maybe ItemPrice'TiersMode'
      -> Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [PriceTier])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tiers")) Parser
  (Maybe ItemPrice'TiersMode'
   -> Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> ItemPrice')
-> Parser (Maybe ItemPrice'TiersMode')
-> Parser
     (Maybe ItemPrice'TransformQuantity'
      -> Maybe ItemPrice'Type' -> Maybe Int -> Maybe Text -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'TiersMode')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tiers_mode")) Parser
  (Maybe ItemPrice'TransformQuantity'
   -> Maybe ItemPrice'Type' -> Maybe Int -> Maybe Text -> ItemPrice')
-> Parser (Maybe ItemPrice'TransformQuantity')
-> Parser
     (Maybe ItemPrice'Type' -> Maybe Int -> Maybe Text -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'TransformQuantity')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"transform_quantity")) Parser
  (Maybe ItemPrice'Type' -> Maybe Int -> Maybe Text -> ItemPrice')
-> Parser (Maybe ItemPrice'Type')
-> Parser (Maybe Int -> Maybe Text -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'Type')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"type")) Parser (Maybe Int -> Maybe Text -> ItemPrice')
-> Parser (Maybe Int) -> Parser (Maybe Text -> ItemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"unit_amount")) Parser (Maybe Text -> ItemPrice')
-> Parser (Maybe Text) -> Parser ItemPrice'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"unit_amount_decimal"))

-- | Create a new 'ItemPrice'' with all required fields.
mkItemPrice' :: ItemPrice'
mkItemPrice' :: ItemPrice'
mkItemPrice' =
  ItemPrice' :: Maybe Bool
-> Maybe ItemPrice'BillingScheme'
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Object
-> Maybe Text
-> Maybe ItemPrice'Object'
-> Maybe ItemPrice'Product'Variants
-> Maybe ItemPrice'Recurring'
-> Maybe ItemPrice'TaxBehavior'
-> Maybe [PriceTier]
-> Maybe ItemPrice'TiersMode'
-> Maybe ItemPrice'TransformQuantity'
-> Maybe ItemPrice'Type'
-> Maybe Int
-> Maybe Text
-> ItemPrice'
ItemPrice'
    { itemPrice'Active :: Maybe Bool
itemPrice'Active = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'BillingScheme :: Maybe ItemPrice'BillingScheme'
itemPrice'BillingScheme = Maybe ItemPrice'BillingScheme'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Created :: Maybe Int
itemPrice'Created = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Currency :: Maybe Text
itemPrice'Currency = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Id :: Maybe Text
itemPrice'Id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Livemode :: Maybe Bool
itemPrice'Livemode = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'LookupKey :: Maybe Text
itemPrice'LookupKey = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Metadata :: Maybe Object
itemPrice'Metadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Nickname :: Maybe Text
itemPrice'Nickname = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Object :: Maybe ItemPrice'Object'
itemPrice'Object = Maybe ItemPrice'Object'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Product :: Maybe ItemPrice'Product'Variants
itemPrice'Product = Maybe ItemPrice'Product'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Recurring :: Maybe ItemPrice'Recurring'
itemPrice'Recurring = Maybe ItemPrice'Recurring'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'TaxBehavior :: Maybe ItemPrice'TaxBehavior'
itemPrice'TaxBehavior = Maybe ItemPrice'TaxBehavior'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Tiers :: Maybe [PriceTier]
itemPrice'Tiers = Maybe [PriceTier]
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'TiersMode :: Maybe ItemPrice'TiersMode'
itemPrice'TiersMode = Maybe ItemPrice'TiersMode'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'TransformQuantity :: Maybe ItemPrice'TransformQuantity'
itemPrice'TransformQuantity = Maybe ItemPrice'TransformQuantity'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Type :: Maybe ItemPrice'Type'
itemPrice'Type = Maybe ItemPrice'Type'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'UnitAmount :: Maybe Int
itemPrice'UnitAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'UnitAmountDecimal :: Maybe Text
itemPrice'UnitAmountDecimal = Maybe Text
forall a. Maybe a
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 (Int -> ItemPrice'BillingScheme' -> ShowS
[ItemPrice'BillingScheme'] -> ShowS
ItemPrice'BillingScheme' -> String
(Int -> ItemPrice'BillingScheme' -> ShowS)
-> (ItemPrice'BillingScheme' -> String)
-> ([ItemPrice'BillingScheme'] -> ShowS)
-> Show ItemPrice'BillingScheme'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'BillingScheme'] -> ShowS
$cshowList :: [ItemPrice'BillingScheme'] -> ShowS
show :: ItemPrice'BillingScheme' -> String
$cshow :: ItemPrice'BillingScheme' -> String
showsPrec :: Int -> ItemPrice'BillingScheme' -> ShowS
$cshowsPrec :: Int -> ItemPrice'BillingScheme' -> ShowS
GHC.Show.Show, ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool
(ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool)
-> (ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool)
-> Eq ItemPrice'BillingScheme'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool
$c/= :: ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool
== :: ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool
$c== :: ItemPrice'BillingScheme' -> ItemPrice'BillingScheme' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'BillingScheme' where
  toJSON :: ItemPrice'BillingScheme' -> Value
toJSON (ItemPrice'BillingScheme'Other Value
val) = Value
val
  toJSON (ItemPrice'BillingScheme'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'BillingScheme'
ItemPrice'BillingScheme'EnumPerUnit) = Value
"per_unit"
  toJSON (ItemPrice'BillingScheme'
ItemPrice'BillingScheme'EnumTiered) = Value
"tiered"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'BillingScheme' where
  parseJSON :: Value -> Parser ItemPrice'BillingScheme'
parseJSON Value
val =
    ItemPrice'BillingScheme' -> Parser ItemPrice'BillingScheme'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"per_unit" -> ItemPrice'BillingScheme'
ItemPrice'BillingScheme'EnumPerUnit
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"tiered" -> ItemPrice'BillingScheme'
ItemPrice'BillingScheme'EnumTiered
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'BillingScheme'
ItemPrice'BillingScheme'Other Value
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 (Int -> ItemPrice'Object' -> ShowS
[ItemPrice'Object'] -> ShowS
ItemPrice'Object' -> String
(Int -> ItemPrice'Object' -> ShowS)
-> (ItemPrice'Object' -> String)
-> ([ItemPrice'Object'] -> ShowS)
-> Show ItemPrice'Object'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Object'] -> ShowS
$cshowList :: [ItemPrice'Object'] -> ShowS
show :: ItemPrice'Object' -> String
$cshow :: ItemPrice'Object' -> String
showsPrec :: Int -> ItemPrice'Object' -> ShowS
$cshowsPrec :: Int -> ItemPrice'Object' -> ShowS
GHC.Show.Show, ItemPrice'Object' -> ItemPrice'Object' -> Bool
(ItemPrice'Object' -> ItemPrice'Object' -> Bool)
-> (ItemPrice'Object' -> ItemPrice'Object' -> Bool)
-> Eq ItemPrice'Object'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Object' -> ItemPrice'Object' -> Bool
$c/= :: ItemPrice'Object' -> ItemPrice'Object' -> Bool
== :: ItemPrice'Object' -> ItemPrice'Object' -> Bool
$c== :: ItemPrice'Object' -> ItemPrice'Object' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Object' where
  toJSON :: ItemPrice'Object' -> Value
toJSON (ItemPrice'Object'Other Value
val) = Value
val
  toJSON (ItemPrice'Object'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'Object'
ItemPrice'Object'EnumPrice) = Value
"price"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Object' where
  parseJSON :: Value -> Parser ItemPrice'Object'
parseJSON Value
val =
    ItemPrice'Object' -> Parser ItemPrice'Object'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"price" -> ItemPrice'Object'
ItemPrice'Object'EnumPrice
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'Object'
ItemPrice'Object'Other Value
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 (Int -> ItemPrice'Product'Variants -> ShowS
[ItemPrice'Product'Variants] -> ShowS
ItemPrice'Product'Variants -> String
(Int -> ItemPrice'Product'Variants -> ShowS)
-> (ItemPrice'Product'Variants -> String)
-> ([ItemPrice'Product'Variants] -> ShowS)
-> Show ItemPrice'Product'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Product'Variants] -> ShowS
$cshowList :: [ItemPrice'Product'Variants] -> ShowS
show :: ItemPrice'Product'Variants -> String
$cshow :: ItemPrice'Product'Variants -> String
showsPrec :: Int -> ItemPrice'Product'Variants -> ShowS
$cshowsPrec :: Int -> ItemPrice'Product'Variants -> ShowS
GHC.Show.Show, ItemPrice'Product'Variants -> ItemPrice'Product'Variants -> Bool
(ItemPrice'Product'Variants -> ItemPrice'Product'Variants -> Bool)
-> (ItemPrice'Product'Variants
    -> ItemPrice'Product'Variants -> Bool)
-> Eq ItemPrice'Product'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Product'Variants -> ItemPrice'Product'Variants -> Bool
$c/= :: ItemPrice'Product'Variants -> ItemPrice'Product'Variants -> Bool
== :: ItemPrice'Product'Variants -> ItemPrice'Product'Variants -> Bool
$c== :: ItemPrice'Product'Variants -> ItemPrice'Product'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Product'Variants where
  toJSON :: ItemPrice'Product'Variants -> Value
toJSON (ItemPrice'Product'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (ItemPrice'Product'Product Product
a) = Product -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Product
a
  toJSON (ItemPrice'Product'DeletedProduct DeletedProduct
a) = DeletedProduct -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON DeletedProduct
a

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Product'Variants where
  parseJSON :: Value -> Parser ItemPrice'Product'Variants
parseJSON Value
val = case (Text -> ItemPrice'Product'Variants
ItemPrice'Product'Text (Text -> ItemPrice'Product'Variants)
-> Result Text -> Result ItemPrice'Product'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result ItemPrice'Product'Variants
-> Result ItemPrice'Product'Variants
-> Result ItemPrice'Product'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Product -> ItemPrice'Product'Variants
ItemPrice'Product'Product (Product -> ItemPrice'Product'Variants)
-> Result Product -> Result ItemPrice'Product'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Product
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result ItemPrice'Product'Variants
-> Result ItemPrice'Product'Variants
-> Result ItemPrice'Product'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((DeletedProduct -> ItemPrice'Product'Variants
ItemPrice'Product'DeletedProduct (DeletedProduct -> ItemPrice'Product'Variants)
-> Result DeletedProduct -> Result ItemPrice'Product'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result DeletedProduct
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result ItemPrice'Product'Variants
-> Result ItemPrice'Product'Variants
-> Result ItemPrice'Product'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result ItemPrice'Product'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")) of
    Data.Aeson.Types.Internal.Success ItemPrice'Product'Variants
a -> ItemPrice'Product'Variants -> Parser ItemPrice'Product'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure ItemPrice'Product'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser ItemPrice'Product'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
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' -> Maybe ItemPrice'Recurring'AggregateUsage'
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' -> Maybe ItemPrice'Recurring'Interval'
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' -> Maybe Int
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' -> Maybe ItemPrice'Recurring'UsageType'
itemPrice'Recurring'UsageType :: (GHC.Maybe.Maybe ItemPrice'Recurring'UsageType')
  }
  deriving
    ( Int -> ItemPrice'Recurring' -> ShowS
[ItemPrice'Recurring'] -> ShowS
ItemPrice'Recurring' -> String
(Int -> ItemPrice'Recurring' -> ShowS)
-> (ItemPrice'Recurring' -> String)
-> ([ItemPrice'Recurring'] -> ShowS)
-> Show ItemPrice'Recurring'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Recurring'] -> ShowS
$cshowList :: [ItemPrice'Recurring'] -> ShowS
show :: ItemPrice'Recurring' -> String
$cshow :: ItemPrice'Recurring' -> String
showsPrec :: Int -> ItemPrice'Recurring' -> ShowS
$cshowsPrec :: Int -> ItemPrice'Recurring' -> ShowS
GHC.Show.Show,
      ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool
(ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool)
-> (ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool)
-> Eq ItemPrice'Recurring'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool
$c/= :: ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool
== :: ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool
$c== :: ItemPrice'Recurring' -> ItemPrice'Recurring' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring' where
  toJSON :: ItemPrice'Recurring' -> Value
toJSON ItemPrice'Recurring'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"aggregate_usage" Text -> Maybe ItemPrice'Recurring'AggregateUsage' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe ItemPrice'Recurring'AggregateUsage'
itemPrice'Recurring'AggregateUsage ItemPrice'Recurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"interval" Text -> Maybe ItemPrice'Recurring'Interval' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe ItemPrice'Recurring'Interval'
itemPrice'Recurring'Interval ItemPrice'Recurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"interval_count" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe Int
itemPrice'Recurring'IntervalCount ItemPrice'Recurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"usage_type" Text -> Maybe ItemPrice'Recurring'UsageType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe ItemPrice'Recurring'UsageType'
itemPrice'Recurring'UsageType ItemPrice'Recurring'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: ItemPrice'Recurring' -> Encoding
toEncoding ItemPrice'Recurring'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"aggregate_usage" Text -> Maybe ItemPrice'Recurring'AggregateUsage' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe ItemPrice'Recurring'AggregateUsage'
itemPrice'Recurring'AggregateUsage ItemPrice'Recurring'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"interval" Text -> Maybe ItemPrice'Recurring'Interval' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe ItemPrice'Recurring'Interval'
itemPrice'Recurring'Interval ItemPrice'Recurring'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"interval_count" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe Int
itemPrice'Recurring'IntervalCount ItemPrice'Recurring'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"usage_type" Text -> Maybe ItemPrice'Recurring'UsageType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'Recurring' -> Maybe ItemPrice'Recurring'UsageType'
itemPrice'Recurring'UsageType ItemPrice'Recurring'
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring' where
  parseJSON :: Value -> Parser ItemPrice'Recurring'
parseJSON = String
-> (Object -> Parser ItemPrice'Recurring')
-> Value
-> Parser ItemPrice'Recurring'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ItemPrice'Recurring'" (\Object
obj -> ((((Maybe ItemPrice'Recurring'AggregateUsage'
 -> Maybe ItemPrice'Recurring'Interval'
 -> Maybe Int
 -> Maybe ItemPrice'Recurring'UsageType'
 -> ItemPrice'Recurring')
-> Parser
     (Maybe ItemPrice'Recurring'AggregateUsage'
      -> Maybe ItemPrice'Recurring'Interval'
      -> Maybe Int
      -> Maybe ItemPrice'Recurring'UsageType'
      -> ItemPrice'Recurring')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe ItemPrice'Recurring'AggregateUsage'
-> Maybe ItemPrice'Recurring'Interval'
-> Maybe Int
-> Maybe ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'
ItemPrice'Recurring' Parser
  (Maybe ItemPrice'Recurring'AggregateUsage'
   -> Maybe ItemPrice'Recurring'Interval'
   -> Maybe Int
   -> Maybe ItemPrice'Recurring'UsageType'
   -> ItemPrice'Recurring')
-> Parser (Maybe ItemPrice'Recurring'AggregateUsage')
-> Parser
     (Maybe ItemPrice'Recurring'Interval'
      -> Maybe Int
      -> Maybe ItemPrice'Recurring'UsageType'
      -> ItemPrice'Recurring')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe ItemPrice'Recurring'AggregateUsage')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"aggregate_usage")) Parser
  (Maybe ItemPrice'Recurring'Interval'
   -> Maybe Int
   -> Maybe ItemPrice'Recurring'UsageType'
   -> ItemPrice'Recurring')
-> Parser (Maybe ItemPrice'Recurring'Interval')
-> Parser
     (Maybe Int
      -> Maybe ItemPrice'Recurring'UsageType' -> ItemPrice'Recurring')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'Recurring'Interval')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"interval")) Parser
  (Maybe Int
   -> Maybe ItemPrice'Recurring'UsageType' -> ItemPrice'Recurring')
-> Parser (Maybe Int)
-> Parser
     (Maybe ItemPrice'Recurring'UsageType' -> ItemPrice'Recurring')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"interval_count")) Parser
  (Maybe ItemPrice'Recurring'UsageType' -> ItemPrice'Recurring')
-> Parser (Maybe ItemPrice'Recurring'UsageType')
-> Parser ItemPrice'Recurring'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'Recurring'UsageType')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"usage_type"))

-- | Create a new 'ItemPrice'Recurring'' with all required fields.
mkItemPrice'Recurring' :: ItemPrice'Recurring'
mkItemPrice'Recurring' :: ItemPrice'Recurring'
mkItemPrice'Recurring' =
  ItemPrice'Recurring' :: Maybe ItemPrice'Recurring'AggregateUsage'
-> Maybe ItemPrice'Recurring'Interval'
-> Maybe Int
-> Maybe ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'
ItemPrice'Recurring'
    { itemPrice'Recurring'AggregateUsage :: Maybe ItemPrice'Recurring'AggregateUsage'
itemPrice'Recurring'AggregateUsage = Maybe ItemPrice'Recurring'AggregateUsage'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Recurring'Interval :: Maybe ItemPrice'Recurring'Interval'
itemPrice'Recurring'Interval = Maybe ItemPrice'Recurring'Interval'
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Recurring'IntervalCount :: Maybe Int
itemPrice'Recurring'IntervalCount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'Recurring'UsageType :: Maybe ItemPrice'Recurring'UsageType'
itemPrice'Recurring'UsageType = Maybe ItemPrice'Recurring'UsageType'
forall a. Maybe a
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 (Int -> ItemPrice'Recurring'AggregateUsage' -> ShowS
[ItemPrice'Recurring'AggregateUsage'] -> ShowS
ItemPrice'Recurring'AggregateUsage' -> String
(Int -> ItemPrice'Recurring'AggregateUsage' -> ShowS)
-> (ItemPrice'Recurring'AggregateUsage' -> String)
-> ([ItemPrice'Recurring'AggregateUsage'] -> ShowS)
-> Show ItemPrice'Recurring'AggregateUsage'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Recurring'AggregateUsage'] -> ShowS
$cshowList :: [ItemPrice'Recurring'AggregateUsage'] -> ShowS
show :: ItemPrice'Recurring'AggregateUsage' -> String
$cshow :: ItemPrice'Recurring'AggregateUsage' -> String
showsPrec :: Int -> ItemPrice'Recurring'AggregateUsage' -> ShowS
$cshowsPrec :: Int -> ItemPrice'Recurring'AggregateUsage' -> ShowS
GHC.Show.Show, ItemPrice'Recurring'AggregateUsage'
-> ItemPrice'Recurring'AggregateUsage' -> Bool
(ItemPrice'Recurring'AggregateUsage'
 -> ItemPrice'Recurring'AggregateUsage' -> Bool)
-> (ItemPrice'Recurring'AggregateUsage'
    -> ItemPrice'Recurring'AggregateUsage' -> Bool)
-> Eq ItemPrice'Recurring'AggregateUsage'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Recurring'AggregateUsage'
-> ItemPrice'Recurring'AggregateUsage' -> Bool
$c/= :: ItemPrice'Recurring'AggregateUsage'
-> ItemPrice'Recurring'AggregateUsage' -> Bool
== :: ItemPrice'Recurring'AggregateUsage'
-> ItemPrice'Recurring'AggregateUsage' -> Bool
$c== :: ItemPrice'Recurring'AggregateUsage'
-> ItemPrice'Recurring'AggregateUsage' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring'AggregateUsage' where
  toJSON :: ItemPrice'Recurring'AggregateUsage' -> Value
toJSON (ItemPrice'Recurring'AggregateUsage'Other Value
val) = Value
val
  toJSON (ItemPrice'Recurring'AggregateUsage'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod) = Value
"last_during_period"
  toJSON (ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumLastEver) = Value
"last_ever"
  toJSON (ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumMax) = Value
"max"
  toJSON (ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumSum) = Value
"sum"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring'AggregateUsage' where
  parseJSON :: Value -> Parser ItemPrice'Recurring'AggregateUsage'
parseJSON Value
val =
    ItemPrice'Recurring'AggregateUsage'
-> Parser ItemPrice'Recurring'AggregateUsage'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"last_during_period" -> ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"last_ever" -> ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumLastEver
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"max" -> ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumMax
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sum" -> ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'EnumSum
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'Recurring'AggregateUsage'
ItemPrice'Recurring'AggregateUsage'Other Value
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 (Int -> ItemPrice'Recurring'Interval' -> ShowS
[ItemPrice'Recurring'Interval'] -> ShowS
ItemPrice'Recurring'Interval' -> String
(Int -> ItemPrice'Recurring'Interval' -> ShowS)
-> (ItemPrice'Recurring'Interval' -> String)
-> ([ItemPrice'Recurring'Interval'] -> ShowS)
-> Show ItemPrice'Recurring'Interval'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Recurring'Interval'] -> ShowS
$cshowList :: [ItemPrice'Recurring'Interval'] -> ShowS
show :: ItemPrice'Recurring'Interval' -> String
$cshow :: ItemPrice'Recurring'Interval' -> String
showsPrec :: Int -> ItemPrice'Recurring'Interval' -> ShowS
$cshowsPrec :: Int -> ItemPrice'Recurring'Interval' -> ShowS
GHC.Show.Show, ItemPrice'Recurring'Interval'
-> ItemPrice'Recurring'Interval' -> Bool
(ItemPrice'Recurring'Interval'
 -> ItemPrice'Recurring'Interval' -> Bool)
-> (ItemPrice'Recurring'Interval'
    -> ItemPrice'Recurring'Interval' -> Bool)
-> Eq ItemPrice'Recurring'Interval'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Recurring'Interval'
-> ItemPrice'Recurring'Interval' -> Bool
$c/= :: ItemPrice'Recurring'Interval'
-> ItemPrice'Recurring'Interval' -> Bool
== :: ItemPrice'Recurring'Interval'
-> ItemPrice'Recurring'Interval' -> Bool
$c== :: ItemPrice'Recurring'Interval'
-> ItemPrice'Recurring'Interval' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring'Interval' where
  toJSON :: ItemPrice'Recurring'Interval' -> Value
toJSON (ItemPrice'Recurring'Interval'Other Value
val) = Value
val
  toJSON (ItemPrice'Recurring'Interval'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumDay) = Value
"day"
  toJSON (ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumMonth) = Value
"month"
  toJSON (ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumWeek) = Value
"week"
  toJSON (ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumYear) = Value
"year"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring'Interval' where
  parseJSON :: Value -> Parser ItemPrice'Recurring'Interval'
parseJSON Value
val =
    ItemPrice'Recurring'Interval'
-> Parser ItemPrice'Recurring'Interval'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"day" -> ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumDay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"month" -> ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumMonth
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"week" -> ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumWeek
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"year" -> ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'EnumYear
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'Recurring'Interval'
ItemPrice'Recurring'Interval'Other Value
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 (Int -> ItemPrice'Recurring'UsageType' -> ShowS
[ItemPrice'Recurring'UsageType'] -> ShowS
ItemPrice'Recurring'UsageType' -> String
(Int -> ItemPrice'Recurring'UsageType' -> ShowS)
-> (ItemPrice'Recurring'UsageType' -> String)
-> ([ItemPrice'Recurring'UsageType'] -> ShowS)
-> Show ItemPrice'Recurring'UsageType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Recurring'UsageType'] -> ShowS
$cshowList :: [ItemPrice'Recurring'UsageType'] -> ShowS
show :: ItemPrice'Recurring'UsageType' -> String
$cshow :: ItemPrice'Recurring'UsageType' -> String
showsPrec :: Int -> ItemPrice'Recurring'UsageType' -> ShowS
$cshowsPrec :: Int -> ItemPrice'Recurring'UsageType' -> ShowS
GHC.Show.Show, ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'UsageType' -> Bool
(ItemPrice'Recurring'UsageType'
 -> ItemPrice'Recurring'UsageType' -> Bool)
-> (ItemPrice'Recurring'UsageType'
    -> ItemPrice'Recurring'UsageType' -> Bool)
-> Eq ItemPrice'Recurring'UsageType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'UsageType' -> Bool
$c/= :: ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'UsageType' -> Bool
== :: ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'UsageType' -> Bool
$c== :: ItemPrice'Recurring'UsageType'
-> ItemPrice'Recurring'UsageType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Recurring'UsageType' where
  toJSON :: ItemPrice'Recurring'UsageType' -> Value
toJSON (ItemPrice'Recurring'UsageType'Other Value
val) = Value
val
  toJSON (ItemPrice'Recurring'UsageType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'Recurring'UsageType'
ItemPrice'Recurring'UsageType'EnumLicensed) = Value
"licensed"
  toJSON (ItemPrice'Recurring'UsageType'
ItemPrice'Recurring'UsageType'EnumMetered) = Value
"metered"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Recurring'UsageType' where
  parseJSON :: Value -> Parser ItemPrice'Recurring'UsageType'
parseJSON Value
val =
    ItemPrice'Recurring'UsageType'
-> Parser ItemPrice'Recurring'UsageType'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"licensed" -> ItemPrice'Recurring'UsageType'
ItemPrice'Recurring'UsageType'EnumLicensed
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"metered" -> ItemPrice'Recurring'UsageType'
ItemPrice'Recurring'UsageType'EnumMetered
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'Recurring'UsageType'
ItemPrice'Recurring'UsageType'Other Value
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 (Int -> ItemPrice'TaxBehavior' -> ShowS
[ItemPrice'TaxBehavior'] -> ShowS
ItemPrice'TaxBehavior' -> String
(Int -> ItemPrice'TaxBehavior' -> ShowS)
-> (ItemPrice'TaxBehavior' -> String)
-> ([ItemPrice'TaxBehavior'] -> ShowS)
-> Show ItemPrice'TaxBehavior'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'TaxBehavior'] -> ShowS
$cshowList :: [ItemPrice'TaxBehavior'] -> ShowS
show :: ItemPrice'TaxBehavior' -> String
$cshow :: ItemPrice'TaxBehavior' -> String
showsPrec :: Int -> ItemPrice'TaxBehavior' -> ShowS
$cshowsPrec :: Int -> ItemPrice'TaxBehavior' -> ShowS
GHC.Show.Show, ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool
(ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool)
-> (ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool)
-> Eq ItemPrice'TaxBehavior'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool
$c/= :: ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool
== :: ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool
$c== :: ItemPrice'TaxBehavior' -> ItemPrice'TaxBehavior' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TaxBehavior' where
  toJSON :: ItemPrice'TaxBehavior' -> Value
toJSON (ItemPrice'TaxBehavior'Other Value
val) = Value
val
  toJSON (ItemPrice'TaxBehavior'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'EnumExclusive) = Value
"exclusive"
  toJSON (ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'EnumInclusive) = Value
"inclusive"
  toJSON (ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'EnumUnspecified) = Value
"unspecified"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TaxBehavior' where
  parseJSON :: Value -> Parser ItemPrice'TaxBehavior'
parseJSON Value
val =
    ItemPrice'TaxBehavior' -> Parser ItemPrice'TaxBehavior'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"exclusive" -> ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'EnumExclusive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inclusive" -> ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'EnumInclusive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"unspecified" -> ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'EnumUnspecified
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'TaxBehavior'
ItemPrice'TaxBehavior'Other Value
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 (Int -> ItemPrice'TiersMode' -> ShowS
[ItemPrice'TiersMode'] -> ShowS
ItemPrice'TiersMode' -> String
(Int -> ItemPrice'TiersMode' -> ShowS)
-> (ItemPrice'TiersMode' -> String)
-> ([ItemPrice'TiersMode'] -> ShowS)
-> Show ItemPrice'TiersMode'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'TiersMode'] -> ShowS
$cshowList :: [ItemPrice'TiersMode'] -> ShowS
show :: ItemPrice'TiersMode' -> String
$cshow :: ItemPrice'TiersMode' -> String
showsPrec :: Int -> ItemPrice'TiersMode' -> ShowS
$cshowsPrec :: Int -> ItemPrice'TiersMode' -> ShowS
GHC.Show.Show, ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool
(ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool)
-> (ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool)
-> Eq ItemPrice'TiersMode'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool
$c/= :: ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool
== :: ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool
$c== :: ItemPrice'TiersMode' -> ItemPrice'TiersMode' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TiersMode' where
  toJSON :: ItemPrice'TiersMode' -> Value
toJSON (ItemPrice'TiersMode'Other Value
val) = Value
val
  toJSON (ItemPrice'TiersMode'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'TiersMode'
ItemPrice'TiersMode'EnumGraduated) = Value
"graduated"
  toJSON (ItemPrice'TiersMode'
ItemPrice'TiersMode'EnumVolume) = Value
"volume"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TiersMode' where
  parseJSON :: Value -> Parser ItemPrice'TiersMode'
parseJSON Value
val =
    ItemPrice'TiersMode' -> Parser ItemPrice'TiersMode'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"graduated" -> ItemPrice'TiersMode'
ItemPrice'TiersMode'EnumGraduated
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"volume" -> ItemPrice'TiersMode'
ItemPrice'TiersMode'EnumVolume
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'TiersMode'
ItemPrice'TiersMode'Other Value
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' -> Maybe Int
itemPrice'TransformQuantity'DivideBy :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | round: After division, either round the result \`up\` or \`down\`.
    ItemPrice'TransformQuantity'
-> Maybe ItemPrice'TransformQuantity'Round'
itemPrice'TransformQuantity'Round :: (GHC.Maybe.Maybe ItemPrice'TransformQuantity'Round')
  }
  deriving
    ( Int -> ItemPrice'TransformQuantity' -> ShowS
[ItemPrice'TransformQuantity'] -> ShowS
ItemPrice'TransformQuantity' -> String
(Int -> ItemPrice'TransformQuantity' -> ShowS)
-> (ItemPrice'TransformQuantity' -> String)
-> ([ItemPrice'TransformQuantity'] -> ShowS)
-> Show ItemPrice'TransformQuantity'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'TransformQuantity'] -> ShowS
$cshowList :: [ItemPrice'TransformQuantity'] -> ShowS
show :: ItemPrice'TransformQuantity' -> String
$cshow :: ItemPrice'TransformQuantity' -> String
showsPrec :: Int -> ItemPrice'TransformQuantity' -> ShowS
$cshowsPrec :: Int -> ItemPrice'TransformQuantity' -> ShowS
GHC.Show.Show,
      ItemPrice'TransformQuantity'
-> ItemPrice'TransformQuantity' -> Bool
(ItemPrice'TransformQuantity'
 -> ItemPrice'TransformQuantity' -> Bool)
-> (ItemPrice'TransformQuantity'
    -> ItemPrice'TransformQuantity' -> Bool)
-> Eq ItemPrice'TransformQuantity'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'TransformQuantity'
-> ItemPrice'TransformQuantity' -> Bool
$c/= :: ItemPrice'TransformQuantity'
-> ItemPrice'TransformQuantity' -> Bool
== :: ItemPrice'TransformQuantity'
-> ItemPrice'TransformQuantity' -> Bool
$c== :: ItemPrice'TransformQuantity'
-> ItemPrice'TransformQuantity' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TransformQuantity' where
  toJSON :: ItemPrice'TransformQuantity' -> Value
toJSON ItemPrice'TransformQuantity'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"divide_by" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'TransformQuantity' -> Maybe Int
itemPrice'TransformQuantity'DivideBy ItemPrice'TransformQuantity'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"round" Text -> Maybe ItemPrice'TransformQuantity'Round' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'TransformQuantity'
-> Maybe ItemPrice'TransformQuantity'Round'
itemPrice'TransformQuantity'Round ItemPrice'TransformQuantity'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: ItemPrice'TransformQuantity' -> Encoding
toEncoding ItemPrice'TransformQuantity'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"divide_by" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'TransformQuantity' -> Maybe Int
itemPrice'TransformQuantity'DivideBy ItemPrice'TransformQuantity'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"round" Text -> Maybe ItemPrice'TransformQuantity'Round' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ItemPrice'TransformQuantity'
-> Maybe ItemPrice'TransformQuantity'Round'
itemPrice'TransformQuantity'Round ItemPrice'TransformQuantity'
obj))

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TransformQuantity' where
  parseJSON :: Value -> Parser ItemPrice'TransformQuantity'
parseJSON = String
-> (Object -> Parser ItemPrice'TransformQuantity')
-> Value
-> Parser ItemPrice'TransformQuantity'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ItemPrice'TransformQuantity'" (\Object
obj -> ((Maybe Int
 -> Maybe ItemPrice'TransformQuantity'Round'
 -> ItemPrice'TransformQuantity')
-> Parser
     (Maybe Int
      -> Maybe ItemPrice'TransformQuantity'Round'
      -> ItemPrice'TransformQuantity')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Int
-> Maybe ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'
ItemPrice'TransformQuantity' Parser
  (Maybe Int
   -> Maybe ItemPrice'TransformQuantity'Round'
   -> ItemPrice'TransformQuantity')
-> Parser (Maybe Int)
-> Parser
     (Maybe ItemPrice'TransformQuantity'Round'
      -> ItemPrice'TransformQuantity')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"divide_by")) Parser
  (Maybe ItemPrice'TransformQuantity'Round'
   -> ItemPrice'TransformQuantity')
-> Parser (Maybe ItemPrice'TransformQuantity'Round')
-> Parser ItemPrice'TransformQuantity'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ItemPrice'TransformQuantity'Round')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"round"))

-- | Create a new 'ItemPrice'TransformQuantity'' with all required fields.
mkItemPrice'TransformQuantity' :: ItemPrice'TransformQuantity'
mkItemPrice'TransformQuantity' :: ItemPrice'TransformQuantity'
mkItemPrice'TransformQuantity' =
  ItemPrice'TransformQuantity' :: Maybe Int
-> Maybe ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'
ItemPrice'TransformQuantity'
    { itemPrice'TransformQuantity'DivideBy :: Maybe Int
itemPrice'TransformQuantity'DivideBy = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      itemPrice'TransformQuantity'Round :: Maybe ItemPrice'TransformQuantity'Round'
itemPrice'TransformQuantity'Round = Maybe ItemPrice'TransformQuantity'Round'
forall a. Maybe a
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 (Int -> ItemPrice'TransformQuantity'Round' -> ShowS
[ItemPrice'TransformQuantity'Round'] -> ShowS
ItemPrice'TransformQuantity'Round' -> String
(Int -> ItemPrice'TransformQuantity'Round' -> ShowS)
-> (ItemPrice'TransformQuantity'Round' -> String)
-> ([ItemPrice'TransformQuantity'Round'] -> ShowS)
-> Show ItemPrice'TransformQuantity'Round'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'TransformQuantity'Round'] -> ShowS
$cshowList :: [ItemPrice'TransformQuantity'Round'] -> ShowS
show :: ItemPrice'TransformQuantity'Round' -> String
$cshow :: ItemPrice'TransformQuantity'Round' -> String
showsPrec :: Int -> ItemPrice'TransformQuantity'Round' -> ShowS
$cshowsPrec :: Int -> ItemPrice'TransformQuantity'Round' -> ShowS
GHC.Show.Show, ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'Round' -> Bool
(ItemPrice'TransformQuantity'Round'
 -> ItemPrice'TransformQuantity'Round' -> Bool)
-> (ItemPrice'TransformQuantity'Round'
    -> ItemPrice'TransformQuantity'Round' -> Bool)
-> Eq ItemPrice'TransformQuantity'Round'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'Round' -> Bool
$c/= :: ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'Round' -> Bool
== :: ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'Round' -> Bool
$c== :: ItemPrice'TransformQuantity'Round'
-> ItemPrice'TransformQuantity'Round' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'TransformQuantity'Round' where
  toJSON :: ItemPrice'TransformQuantity'Round' -> Value
toJSON (ItemPrice'TransformQuantity'Round'Other Value
val) = Value
val
  toJSON (ItemPrice'TransformQuantity'Round'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'TransformQuantity'Round'
ItemPrice'TransformQuantity'Round'EnumDown) = Value
"down"
  toJSON (ItemPrice'TransformQuantity'Round'
ItemPrice'TransformQuantity'Round'EnumUp) = Value
"up"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'TransformQuantity'Round' where
  parseJSON :: Value -> Parser ItemPrice'TransformQuantity'Round'
parseJSON Value
val =
    ItemPrice'TransformQuantity'Round'
-> Parser ItemPrice'TransformQuantity'Round'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"down" -> ItemPrice'TransformQuantity'Round'
ItemPrice'TransformQuantity'Round'EnumDown
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"up" -> ItemPrice'TransformQuantity'Round'
ItemPrice'TransformQuantity'Round'EnumUp
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'TransformQuantity'Round'
ItemPrice'TransformQuantity'Round'Other Value
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 (Int -> ItemPrice'Type' -> ShowS
[ItemPrice'Type'] -> ShowS
ItemPrice'Type' -> String
(Int -> ItemPrice'Type' -> ShowS)
-> (ItemPrice'Type' -> String)
-> ([ItemPrice'Type'] -> ShowS)
-> Show ItemPrice'Type'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemPrice'Type'] -> ShowS
$cshowList :: [ItemPrice'Type'] -> ShowS
show :: ItemPrice'Type' -> String
$cshow :: ItemPrice'Type' -> String
showsPrec :: Int -> ItemPrice'Type' -> ShowS
$cshowsPrec :: Int -> ItemPrice'Type' -> ShowS
GHC.Show.Show, ItemPrice'Type' -> ItemPrice'Type' -> Bool
(ItemPrice'Type' -> ItemPrice'Type' -> Bool)
-> (ItemPrice'Type' -> ItemPrice'Type' -> Bool)
-> Eq ItemPrice'Type'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemPrice'Type' -> ItemPrice'Type' -> Bool
$c/= :: ItemPrice'Type' -> ItemPrice'Type' -> Bool
== :: ItemPrice'Type' -> ItemPrice'Type' -> Bool
$c== :: ItemPrice'Type' -> ItemPrice'Type' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON ItemPrice'Type' where
  toJSON :: ItemPrice'Type' -> Value
toJSON (ItemPrice'Type'Other Value
val) = Value
val
  toJSON (ItemPrice'Type'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (ItemPrice'Type'
ItemPrice'Type'EnumOneTime) = Value
"one_time"
  toJSON (ItemPrice'Type'
ItemPrice'Type'EnumRecurring) = Value
"recurring"

instance Data.Aeson.Types.FromJSON.FromJSON ItemPrice'Type' where
  parseJSON :: Value -> Parser ItemPrice'Type'
parseJSON Value
val =
    ItemPrice'Type' -> Parser ItemPrice'Type'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"one_time" -> ItemPrice'Type'
ItemPrice'Type'EnumOneTime
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"recurring" -> ItemPrice'Type'
ItemPrice'Type'EnumRecurring
            | Bool
GHC.Base.otherwise -> Value -> ItemPrice'Type'
ItemPrice'Type'Other Value
val
      )