{-# 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 Invoiceitem
module StripeAPI.Types.Invoiceitem 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.Customer
import {-# SOURCE #-} StripeAPI.Types.DeletedCustomer
import {-# SOURCE #-} StripeAPI.Types.DeletedProduct
import {-# SOURCE #-} StripeAPI.Types.Discount
import {-# SOURCE #-} StripeAPI.Types.Invoice
import {-# SOURCE #-} StripeAPI.Types.InvoiceLineItemPeriod
import {-# SOURCE #-} StripeAPI.Types.Price
import {-# SOURCE #-} StripeAPI.Types.PriceTier
import {-# SOURCE #-} StripeAPI.Types.Product
import {-# SOURCE #-} StripeAPI.Types.Recurring
import {-# SOURCE #-} StripeAPI.Types.Subscription
import {-# SOURCE #-} StripeAPI.Types.TaxRate
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.invoiceitem@ in the specification.
--
-- Sometimes you want to add a charge or credit to a customer, but actually
-- charge or credit the customer\'s card only at the end of a regular billing
-- cycle. This is useful for combining several charges (to minimize
-- per-transaction fees), or for having Stripe tabulate your usage-based billing
-- totals.
--
-- Related guide: [Subscription Invoices](https:\/\/stripe.com\/docs\/billing\/invoices\/subscription\#adding-upcoming-invoice-items).
data Invoiceitem = Invoiceitem
  { -- | amount: Amount (in the \`currency\` specified) of the invoice item. This should always be equal to \`unit_amount * quantity\`.
    Invoiceitem -> Int
invoiceitemAmount :: 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).
    Invoiceitem -> Text
invoiceitemCurrency :: Data.Text.Internal.Text,
    -- | customer: The ID of the customer who will be billed when this invoice item is billed.
    Invoiceitem -> InvoiceitemCustomer'Variants
invoiceitemCustomer :: InvoiceitemCustomer'Variants,
    -- | date: Time at which the object was created. Measured in seconds since the Unix epoch.
    Invoiceitem -> Int
invoiceitemDate :: GHC.Types.Int,
    -- | description: An arbitrary string attached to the object. Often useful for displaying to users.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Invoiceitem -> Maybe Text
invoiceitemDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | discountable: If true, discounts will apply to this invoice item. Always false for prorations.
    Invoiceitem -> Bool
invoiceitemDiscountable :: GHC.Types.Bool,
    -- | discounts: The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use \`expand[]=discounts\` to expand each discount.
    Invoiceitem -> Maybe [InvoiceitemDiscounts'Variants]
invoiceitemDiscounts :: (GHC.Maybe.Maybe ([InvoiceitemDiscounts'Variants])),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Invoiceitem -> Text
invoiceitemId :: Data.Text.Internal.Text,
    -- | invoice: The ID of the invoice this invoice item belongs to.
    Invoiceitem -> Maybe InvoiceitemInvoice'Variants
invoiceitemInvoice :: (GHC.Maybe.Maybe InvoiceitemInvoice'Variants),
    -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.
    Invoiceitem -> Bool
invoiceitemLivemode :: GHC.Types.Bool,
    -- | 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.
    Invoiceitem -> Maybe Object
invoiceitemMetadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | period:
    Invoiceitem -> InvoiceLineItemPeriod
invoiceitemPeriod :: InvoiceLineItemPeriod,
    -- | price: The price of the invoice item.
    Invoiceitem -> Maybe InvoiceitemPrice'
invoiceitemPrice :: (GHC.Maybe.Maybe InvoiceitemPrice'),
    -- | proration: Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.
    Invoiceitem -> Bool
invoiceitemProration :: GHC.Types.Bool,
    -- | quantity: Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for.
    Invoiceitem -> Int
invoiceitemQuantity :: GHC.Types.Int,
    -- | subscription: The subscription that this invoice item has been created for, if any.
    Invoiceitem -> Maybe InvoiceitemSubscription'Variants
invoiceitemSubscription :: (GHC.Maybe.Maybe InvoiceitemSubscription'Variants),
    -- | subscription_item: The subscription item that this invoice item has been created for, if any.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Invoiceitem -> Maybe Text
invoiceitemSubscriptionItem :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | tax_rates: The tax rates which apply to the invoice item. When set, the \`default_tax_rates\` on the invoice do not apply to this invoice item.
    Invoiceitem -> Maybe [TaxRate]
invoiceitemTaxRates :: (GHC.Maybe.Maybe ([TaxRate])),
    -- | unit_amount: Unit amount (in the \`currency\` specified) of the invoice item.
    Invoiceitem -> Maybe Int
invoiceitemUnitAmount :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | unit_amount_decimal: Same as \`unit_amount\`, but contains a decimal value with at most 12 decimal places.
    Invoiceitem -> Maybe Text
invoiceitemUnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> Invoiceitem -> ShowS
[Invoiceitem] -> ShowS
Invoiceitem -> String
(Int -> Invoiceitem -> ShowS)
-> (Invoiceitem -> String)
-> ([Invoiceitem] -> ShowS)
-> Show Invoiceitem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Invoiceitem] -> ShowS
$cshowList :: [Invoiceitem] -> ShowS
show :: Invoiceitem -> String
$cshow :: Invoiceitem -> String
showsPrec :: Int -> Invoiceitem -> ShowS
$cshowsPrec :: Int -> Invoiceitem -> ShowS
GHC.Show.Show,
      Invoiceitem -> Invoiceitem -> Bool
(Invoiceitem -> Invoiceitem -> Bool)
-> (Invoiceitem -> Invoiceitem -> Bool) -> Eq Invoiceitem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Invoiceitem -> Invoiceitem -> Bool
$c/= :: Invoiceitem -> Invoiceitem -> Bool
== :: Invoiceitem -> Invoiceitem -> Bool
$c== :: Invoiceitem -> Invoiceitem -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON Invoiceitem where
  toJSON :: Invoiceitem -> Value
toJSON Invoiceitem
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"amount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Int
invoiceitemAmount Invoiceitem
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..= Invoiceitem -> Text
invoiceitemCurrency Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer" Text -> InvoiceitemCustomer'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> InvoiceitemCustomer'Variants
invoiceitemCustomer Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"date" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Int
invoiceitemDate Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"description" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe Text
invoiceitemDescription Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discountable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Bool
invoiceitemDiscountable Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discounts" Text -> Maybe [InvoiceitemDiscounts'Variants] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe [InvoiceitemDiscounts'Variants]
invoiceitemDiscounts Invoiceitem
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..= Invoiceitem -> Text
invoiceitemId Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice" Text -> Maybe InvoiceitemInvoice'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe InvoiceitemInvoice'Variants
invoiceitemInvoice Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Bool
invoiceitemLivemode Invoiceitem
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..= Invoiceitem -> Maybe Object
invoiceitemMetadata Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"period" Text -> InvoiceLineItemPeriod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> InvoiceLineItemPeriod
invoiceitemPeriod Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"price" Text -> Maybe InvoiceitemPrice' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe InvoiceitemPrice'
invoiceitemPrice Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"proration" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Bool
invoiceitemProration Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"quantity" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Int
invoiceitemQuantity Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"subscription" Text -> Maybe InvoiceitemSubscription'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe InvoiceitemSubscription'Variants
invoiceitemSubscription Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"subscription_item" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe Text
invoiceitemSubscriptionItem Invoiceitem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_rates" Text -> Maybe [TaxRate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe [TaxRate]
invoiceitemTaxRates Invoiceitem
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..= Invoiceitem -> Maybe Int
invoiceitemUnitAmount Invoiceitem
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..= Invoiceitem -> Maybe Text
invoiceitemUnitAmountDecimal Invoiceitem
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
"invoiceitem" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: Invoiceitem -> Encoding
toEncoding Invoiceitem
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"amount" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Int
invoiceitemAmount Invoiceitem
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..= Invoiceitem -> Text
invoiceitemCurrency Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer" Text -> InvoiceitemCustomer'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> InvoiceitemCustomer'Variants
invoiceitemCustomer Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"date" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Int
invoiceitemDate Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"description" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe Text
invoiceitemDescription Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discountable" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Bool
invoiceitemDiscountable Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discounts" Text -> Maybe [InvoiceitemDiscounts'Variants] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe [InvoiceitemDiscounts'Variants]
invoiceitemDiscounts Invoiceitem
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..= Invoiceitem -> Text
invoiceitemId Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice" Text -> Maybe InvoiceitemInvoice'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe InvoiceitemInvoice'Variants
invoiceitemInvoice Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Bool
invoiceitemLivemode Invoiceitem
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..= Invoiceitem -> Maybe Object
invoiceitemMetadata Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"period" Text -> InvoiceLineItemPeriod -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> InvoiceLineItemPeriod
invoiceitemPeriod Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"price" Text -> Maybe InvoiceitemPrice' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe InvoiceitemPrice'
invoiceitemPrice Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"proration" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Bool
invoiceitemProration Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"quantity" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Int
invoiceitemQuantity Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"subscription" Text -> Maybe InvoiceitemSubscription'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe InvoiceitemSubscription'Variants
invoiceitemSubscription Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"subscription_item" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe Text
invoiceitemSubscriptionItem Invoiceitem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_rates" Text -> Maybe [TaxRate] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Invoiceitem -> Maybe [TaxRate]
invoiceitemTaxRates Invoiceitem
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..= Invoiceitem -> Maybe Int
invoiceitemUnitAmount Invoiceitem
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..= Invoiceitem -> Maybe Text
invoiceitemUnitAmountDecimal Invoiceitem
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
"invoiceitem")))))))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON Invoiceitem where
  parseJSON :: Value -> Parser Invoiceitem
parseJSON = String
-> (Object -> Parser Invoiceitem) -> Value -> Parser Invoiceitem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Invoiceitem" (\Object
obj -> ((((((((((((((((((((Int
 -> Text
 -> InvoiceitemCustomer'Variants
 -> Int
 -> Maybe Text
 -> Bool
 -> Maybe [InvoiceitemDiscounts'Variants]
 -> Text
 -> Maybe InvoiceitemInvoice'Variants
 -> Bool
 -> Maybe Object
 -> InvoiceLineItemPeriod
 -> Maybe InvoiceitemPrice'
 -> Bool
 -> Int
 -> Maybe InvoiceitemSubscription'Variants
 -> Maybe Text
 -> Maybe [TaxRate]
 -> Maybe Int
 -> Maybe Text
 -> Invoiceitem)
-> Parser
     (Int
      -> Text
      -> InvoiceitemCustomer'Variants
      -> Int
      -> Maybe Text
      -> Bool
      -> Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Text
-> InvoiceitemCustomer'Variants
-> Int
-> Maybe Text
-> Bool
-> Maybe [InvoiceitemDiscounts'Variants]
-> Text
-> Maybe InvoiceitemInvoice'Variants
-> Bool
-> Maybe Object
-> InvoiceLineItemPeriod
-> Maybe InvoiceitemPrice'
-> Bool
-> Int
-> Maybe InvoiceitemSubscription'Variants
-> Maybe Text
-> Maybe [TaxRate]
-> Maybe Int
-> Maybe Text
-> Invoiceitem
Invoiceitem Parser
  (Int
   -> Text
   -> InvoiceitemCustomer'Variants
   -> Int
   -> Maybe Text
   -> Bool
   -> Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Int
-> Parser
     (Text
      -> InvoiceitemCustomer'Variants
      -> Int
      -> Maybe Text
      -> Bool
      -> Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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")) Parser
  (Text
   -> InvoiceitemCustomer'Variants
   -> Int
   -> Maybe Text
   -> Bool
   -> Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Text
-> Parser
     (InvoiceitemCustomer'Variants
      -> Int
      -> Maybe Text
      -> Bool
      -> Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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
  (InvoiceitemCustomer'Variants
   -> Int
   -> Maybe Text
   -> Bool
   -> Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser InvoiceitemCustomer'Variants
-> Parser
     (Int
      -> Maybe Text
      -> Bool
      -> Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser InvoiceitemCustomer'Variants
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"customer")) Parser
  (Int
   -> Maybe Text
   -> Bool
   -> Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Int
-> Parser
     (Maybe Text
      -> Bool
      -> Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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
"date")) Parser
  (Maybe Text
   -> Bool
   -> Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser (Maybe Text)
-> Parser
     (Bool
      -> Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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
"description")) Parser
  (Bool
   -> Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Bool
-> Parser
     (Maybe [InvoiceitemDiscounts'Variants]
      -> Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"discountable")) Parser
  (Maybe [InvoiceitemDiscounts'Variants]
   -> Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser (Maybe [InvoiceitemDiscounts'Variants])
-> Parser
     (Text
      -> Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [InvoiceitemDiscounts'Variants])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"discounts")) Parser
  (Text
   -> Maybe InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Text
-> Parser
     (Maybe InvoiceitemInvoice'Variants
      -> Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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 InvoiceitemInvoice'Variants
   -> Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser (Maybe InvoiceitemInvoice'Variants)
-> Parser
     (Bool
      -> Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemInvoice'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"invoice")) Parser
  (Bool
   -> Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Bool
-> Parser
     (Maybe Object
      -> InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"livemode")) Parser
  (Maybe Object
   -> InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser (Maybe Object)
-> Parser
     (InvoiceLineItemPeriod
      -> Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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
  (InvoiceLineItemPeriod
   -> Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser InvoiceLineItemPeriod
-> Parser
     (Maybe InvoiceitemPrice'
      -> Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser InvoiceLineItemPeriod
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"period")) Parser
  (Maybe InvoiceitemPrice'
   -> Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser (Maybe InvoiceitemPrice')
-> Parser
     (Bool
      -> Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"price")) Parser
  (Bool
   -> Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Bool
-> Parser
     (Int
      -> Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"proration")) Parser
  (Int
   -> Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser Int
-> Parser
     (Maybe InvoiceitemSubscription'Variants
      -> Maybe Text
      -> Maybe [TaxRate]
      -> Maybe Int
      -> Maybe Text
      -> Invoiceitem)
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
"quantity")) Parser
  (Maybe InvoiceitemSubscription'Variants
   -> Maybe Text
   -> Maybe [TaxRate]
   -> Maybe Int
   -> Maybe Text
   -> Invoiceitem)
-> Parser (Maybe InvoiceitemSubscription'Variants)
-> Parser
     (Maybe Text
      -> Maybe [TaxRate] -> Maybe Int -> Maybe Text -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemSubscription'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"subscription")) Parser
  (Maybe Text
   -> Maybe [TaxRate] -> Maybe Int -> Maybe Text -> Invoiceitem)
-> Parser (Maybe Text)
-> Parser
     (Maybe [TaxRate] -> Maybe Int -> Maybe Text -> Invoiceitem)
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
"subscription_item")) Parser (Maybe [TaxRate] -> Maybe Int -> Maybe Text -> Invoiceitem)
-> Parser (Maybe [TaxRate])
-> Parser (Maybe Int -> Maybe Text -> Invoiceitem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [TaxRate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_rates")) Parser (Maybe Int -> Maybe Text -> Invoiceitem)
-> Parser (Maybe Int) -> Parser (Maybe Text -> Invoiceitem)
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 -> Invoiceitem)
-> Parser (Maybe Text) -> Parser Invoiceitem
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 'Invoiceitem' with all required fields.
mkInvoiceitem ::
  -- | 'invoiceitemAmount'
  GHC.Types.Int ->
  -- | 'invoiceitemCurrency'
  Data.Text.Internal.Text ->
  -- | 'invoiceitemCustomer'
  InvoiceitemCustomer'Variants ->
  -- | 'invoiceitemDate'
  GHC.Types.Int ->
  -- | 'invoiceitemDiscountable'
  GHC.Types.Bool ->
  -- | 'invoiceitemId'
  Data.Text.Internal.Text ->
  -- | 'invoiceitemLivemode'
  GHC.Types.Bool ->
  -- | 'invoiceitemPeriod'
  InvoiceLineItemPeriod ->
  -- | 'invoiceitemProration'
  GHC.Types.Bool ->
  -- | 'invoiceitemQuantity'
  GHC.Types.Int ->
  Invoiceitem
mkInvoiceitem :: Int
-> Text
-> InvoiceitemCustomer'Variants
-> Int
-> Bool
-> Text
-> Bool
-> InvoiceLineItemPeriod
-> Bool
-> Int
-> Invoiceitem
mkInvoiceitem Int
invoiceitemAmount Text
invoiceitemCurrency InvoiceitemCustomer'Variants
invoiceitemCustomer Int
invoiceitemDate Bool
invoiceitemDiscountable Text
invoiceitemId Bool
invoiceitemLivemode InvoiceLineItemPeriod
invoiceitemPeriod Bool
invoiceitemProration Int
invoiceitemQuantity =
  Invoiceitem :: Int
-> Text
-> InvoiceitemCustomer'Variants
-> Int
-> Maybe Text
-> Bool
-> Maybe [InvoiceitemDiscounts'Variants]
-> Text
-> Maybe InvoiceitemInvoice'Variants
-> Bool
-> Maybe Object
-> InvoiceLineItemPeriod
-> Maybe InvoiceitemPrice'
-> Bool
-> Int
-> Maybe InvoiceitemSubscription'Variants
-> Maybe Text
-> Maybe [TaxRate]
-> Maybe Int
-> Maybe Text
-> Invoiceitem
Invoiceitem
    { invoiceitemAmount :: Int
invoiceitemAmount = Int
invoiceitemAmount,
      invoiceitemCurrency :: Text
invoiceitemCurrency = Text
invoiceitemCurrency,
      invoiceitemCustomer :: InvoiceitemCustomer'Variants
invoiceitemCustomer = InvoiceitemCustomer'Variants
invoiceitemCustomer,
      invoiceitemDate :: Int
invoiceitemDate = Int
invoiceitemDate,
      invoiceitemDescription :: Maybe Text
invoiceitemDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemDiscountable :: Bool
invoiceitemDiscountable = Bool
invoiceitemDiscountable,
      invoiceitemDiscounts :: Maybe [InvoiceitemDiscounts'Variants]
invoiceitemDiscounts = Maybe [InvoiceitemDiscounts'Variants]
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemId :: Text
invoiceitemId = Text
invoiceitemId,
      invoiceitemInvoice :: Maybe InvoiceitemInvoice'Variants
invoiceitemInvoice = Maybe InvoiceitemInvoice'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemLivemode :: Bool
invoiceitemLivemode = Bool
invoiceitemLivemode,
      invoiceitemMetadata :: Maybe Object
invoiceitemMetadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPeriod :: InvoiceLineItemPeriod
invoiceitemPeriod = InvoiceLineItemPeriod
invoiceitemPeriod,
      invoiceitemPrice :: Maybe InvoiceitemPrice'
invoiceitemPrice = Maybe InvoiceitemPrice'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemProration :: Bool
invoiceitemProration = Bool
invoiceitemProration,
      invoiceitemQuantity :: Int
invoiceitemQuantity = Int
invoiceitemQuantity,
      invoiceitemSubscription :: Maybe InvoiceitemSubscription'Variants
invoiceitemSubscription = Maybe InvoiceitemSubscription'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemSubscriptionItem :: Maybe Text
invoiceitemSubscriptionItem = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemTaxRates :: Maybe [TaxRate]
invoiceitemTaxRates = Maybe [TaxRate]
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemUnitAmount :: Maybe Int
invoiceitemUnitAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemUnitAmountDecimal :: Maybe Text
invoiceitemUnitAmountDecimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @components.schemas.invoiceitem.properties.customer.anyOf@ in the specification.
--
-- The ID of the customer who will be billed when this invoice item is billed.
data InvoiceitemCustomer'Variants
  = InvoiceitemCustomer'Text Data.Text.Internal.Text
  | InvoiceitemCustomer'Customer Customer
  | InvoiceitemCustomer'DeletedCustomer DeletedCustomer
  deriving (Int -> InvoiceitemCustomer'Variants -> ShowS
[InvoiceitemCustomer'Variants] -> ShowS
InvoiceitemCustomer'Variants -> String
(Int -> InvoiceitemCustomer'Variants -> ShowS)
-> (InvoiceitemCustomer'Variants -> String)
-> ([InvoiceitemCustomer'Variants] -> ShowS)
-> Show InvoiceitemCustomer'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemCustomer'Variants] -> ShowS
$cshowList :: [InvoiceitemCustomer'Variants] -> ShowS
show :: InvoiceitemCustomer'Variants -> String
$cshow :: InvoiceitemCustomer'Variants -> String
showsPrec :: Int -> InvoiceitemCustomer'Variants -> ShowS
$cshowsPrec :: Int -> InvoiceitemCustomer'Variants -> ShowS
GHC.Show.Show, InvoiceitemCustomer'Variants
-> InvoiceitemCustomer'Variants -> Bool
(InvoiceitemCustomer'Variants
 -> InvoiceitemCustomer'Variants -> Bool)
-> (InvoiceitemCustomer'Variants
    -> InvoiceitemCustomer'Variants -> Bool)
-> Eq InvoiceitemCustomer'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemCustomer'Variants
-> InvoiceitemCustomer'Variants -> Bool
$c/= :: InvoiceitemCustomer'Variants
-> InvoiceitemCustomer'Variants -> Bool
== :: InvoiceitemCustomer'Variants
-> InvoiceitemCustomer'Variants -> Bool
$c== :: InvoiceitemCustomer'Variants
-> InvoiceitemCustomer'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceitemCustomer'Variants where
  toJSON :: InvoiceitemCustomer'Variants -> Value
toJSON (InvoiceitemCustomer'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (InvoiceitemCustomer'Customer Customer
a) = Customer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Customer
a
  toJSON (InvoiceitemCustomer'DeletedCustomer DeletedCustomer
a) = DeletedCustomer -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON DeletedCustomer
a

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemCustomer'Variants where
  parseJSON :: Value -> Parser InvoiceitemCustomer'Variants
parseJSON Value
val = case (Text -> InvoiceitemCustomer'Variants
InvoiceitemCustomer'Text (Text -> InvoiceitemCustomer'Variants)
-> Result Text -> Result InvoiceitemCustomer'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 InvoiceitemCustomer'Variants
-> Result InvoiceitemCustomer'Variants
-> Result InvoiceitemCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Customer -> InvoiceitemCustomer'Variants
InvoiceitemCustomer'Customer (Customer -> InvoiceitemCustomer'Variants)
-> Result Customer -> Result InvoiceitemCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Customer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result InvoiceitemCustomer'Variants
-> Result InvoiceitemCustomer'Variants
-> Result InvoiceitemCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((DeletedCustomer -> InvoiceitemCustomer'Variants
InvoiceitemCustomer'DeletedCustomer (DeletedCustomer -> InvoiceitemCustomer'Variants)
-> Result DeletedCustomer -> Result InvoiceitemCustomer'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result DeletedCustomer
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result InvoiceitemCustomer'Variants
-> Result InvoiceitemCustomer'Variants
-> Result InvoiceitemCustomer'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result InvoiceitemCustomer'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")) of
    Data.Aeson.Types.Internal.Success InvoiceitemCustomer'Variants
a -> InvoiceitemCustomer'Variants -> Parser InvoiceitemCustomer'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure InvoiceitemCustomer'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser InvoiceitemCustomer'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the oneOf schema located at @components.schemas.invoiceitem.properties.discounts.items.anyOf@ in the specification.
data InvoiceitemDiscounts'Variants
  = InvoiceitemDiscounts'Text Data.Text.Internal.Text
  | InvoiceitemDiscounts'Discount Discount
  deriving (Int -> InvoiceitemDiscounts'Variants -> ShowS
[InvoiceitemDiscounts'Variants] -> ShowS
InvoiceitemDiscounts'Variants -> String
(Int -> InvoiceitemDiscounts'Variants -> ShowS)
-> (InvoiceitemDiscounts'Variants -> String)
-> ([InvoiceitemDiscounts'Variants] -> ShowS)
-> Show InvoiceitemDiscounts'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemDiscounts'Variants] -> ShowS
$cshowList :: [InvoiceitemDiscounts'Variants] -> ShowS
show :: InvoiceitemDiscounts'Variants -> String
$cshow :: InvoiceitemDiscounts'Variants -> String
showsPrec :: Int -> InvoiceitemDiscounts'Variants -> ShowS
$cshowsPrec :: Int -> InvoiceitemDiscounts'Variants -> ShowS
GHC.Show.Show, InvoiceitemDiscounts'Variants
-> InvoiceitemDiscounts'Variants -> Bool
(InvoiceitemDiscounts'Variants
 -> InvoiceitemDiscounts'Variants -> Bool)
-> (InvoiceitemDiscounts'Variants
    -> InvoiceitemDiscounts'Variants -> Bool)
-> Eq InvoiceitemDiscounts'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemDiscounts'Variants
-> InvoiceitemDiscounts'Variants -> Bool
$c/= :: InvoiceitemDiscounts'Variants
-> InvoiceitemDiscounts'Variants -> Bool
== :: InvoiceitemDiscounts'Variants
-> InvoiceitemDiscounts'Variants -> Bool
$c== :: InvoiceitemDiscounts'Variants
-> InvoiceitemDiscounts'Variants -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemDiscounts'Variants where
  parseJSON :: Value -> Parser InvoiceitemDiscounts'Variants
parseJSON Value
val = case (Text -> InvoiceitemDiscounts'Variants
InvoiceitemDiscounts'Text (Text -> InvoiceitemDiscounts'Variants)
-> Result Text -> Result InvoiceitemDiscounts'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 InvoiceitemDiscounts'Variants
-> Result InvoiceitemDiscounts'Variants
-> Result InvoiceitemDiscounts'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Discount -> InvoiceitemDiscounts'Variants
InvoiceitemDiscounts'Discount (Discount -> InvoiceitemDiscounts'Variants)
-> Result Discount -> Result InvoiceitemDiscounts'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Discount
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result InvoiceitemDiscounts'Variants
-> Result InvoiceitemDiscounts'Variants
-> Result InvoiceitemDiscounts'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result InvoiceitemDiscounts'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success InvoiceitemDiscounts'Variants
a -> InvoiceitemDiscounts'Variants
-> Parser InvoiceitemDiscounts'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure InvoiceitemDiscounts'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser InvoiceitemDiscounts'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the oneOf schema located at @components.schemas.invoiceitem.properties.invoice.anyOf@ in the specification.
--
-- The ID of the invoice this invoice item belongs to.
data InvoiceitemInvoice'Variants
  = InvoiceitemInvoice'Text Data.Text.Internal.Text
  | InvoiceitemInvoice'Invoice Invoice
  deriving (Int -> InvoiceitemInvoice'Variants -> ShowS
[InvoiceitemInvoice'Variants] -> ShowS
InvoiceitemInvoice'Variants -> String
(Int -> InvoiceitemInvoice'Variants -> ShowS)
-> (InvoiceitemInvoice'Variants -> String)
-> ([InvoiceitemInvoice'Variants] -> ShowS)
-> Show InvoiceitemInvoice'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemInvoice'Variants] -> ShowS
$cshowList :: [InvoiceitemInvoice'Variants] -> ShowS
show :: InvoiceitemInvoice'Variants -> String
$cshow :: InvoiceitemInvoice'Variants -> String
showsPrec :: Int -> InvoiceitemInvoice'Variants -> ShowS
$cshowsPrec :: Int -> InvoiceitemInvoice'Variants -> ShowS
GHC.Show.Show, InvoiceitemInvoice'Variants -> InvoiceitemInvoice'Variants -> Bool
(InvoiceitemInvoice'Variants
 -> InvoiceitemInvoice'Variants -> Bool)
-> (InvoiceitemInvoice'Variants
    -> InvoiceitemInvoice'Variants -> Bool)
-> Eq InvoiceitemInvoice'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemInvoice'Variants -> InvoiceitemInvoice'Variants -> Bool
$c/= :: InvoiceitemInvoice'Variants -> InvoiceitemInvoice'Variants -> Bool
== :: InvoiceitemInvoice'Variants -> InvoiceitemInvoice'Variants -> Bool
$c== :: InvoiceitemInvoice'Variants -> InvoiceitemInvoice'Variants -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemInvoice'Variants where
  parseJSON :: Value -> Parser InvoiceitemInvoice'Variants
parseJSON Value
val = case (Text -> InvoiceitemInvoice'Variants
InvoiceitemInvoice'Text (Text -> InvoiceitemInvoice'Variants)
-> Result Text -> Result InvoiceitemInvoice'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 InvoiceitemInvoice'Variants
-> Result InvoiceitemInvoice'Variants
-> Result InvoiceitemInvoice'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Invoice -> InvoiceitemInvoice'Variants
InvoiceitemInvoice'Invoice (Invoice -> InvoiceitemInvoice'Variants)
-> Result Invoice -> Result InvoiceitemInvoice'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Invoice
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result InvoiceitemInvoice'Variants
-> Result InvoiceitemInvoice'Variants
-> Result InvoiceitemInvoice'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result InvoiceitemInvoice'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success InvoiceitemInvoice'Variants
a -> InvoiceitemInvoice'Variants -> Parser InvoiceitemInvoice'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure InvoiceitemInvoice'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser InvoiceitemInvoice'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the object schema located at @components.schemas.invoiceitem.properties.price.anyOf@ in the specification.
--
-- The price of the invoice item.
data InvoiceitemPrice' = InvoiceitemPrice'
  { -- | active: Whether the price can be used for new purchases.
    InvoiceitemPrice' -> Maybe Bool
invoiceitemPrice'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.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'BillingScheme'
invoiceitemPrice'BillingScheme :: (GHC.Maybe.Maybe InvoiceitemPrice'BillingScheme'),
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    InvoiceitemPrice' -> Maybe Int
invoiceitemPrice'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).
    InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Currency :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'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.
    InvoiceitemPrice' -> Maybe Bool
invoiceitemPrice'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
    InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'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.
    InvoiceitemPrice' -> Maybe Object
invoiceitemPrice'Metadata :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object),
    -- | nickname: A brief description of the price, hidden from customers.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Nickname :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | product: The ID of the product this price is associated with.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'Product'Variants
invoiceitemPrice'Product :: (GHC.Maybe.Maybe InvoiceitemPrice'Product'Variants),
    -- | recurring: The recurring components of a price such as \`interval\` and \`usage_type\`.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'Recurring'
invoiceitemPrice'Recurring :: (GHC.Maybe.Maybe InvoiceitemPrice'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.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'TaxBehavior'
invoiceitemPrice'TaxBehavior :: (GHC.Maybe.Maybe InvoiceitemPrice'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\`.
    InvoiceitemPrice' -> Maybe [PriceTier]
invoiceitemPrice'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.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'TiersMode'
invoiceitemPrice'TiersMode :: (GHC.Maybe.Maybe InvoiceitemPrice'TiersMode'),
    -- | transform_quantity: Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with \`tiers\`.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'TransformQuantity'
invoiceitemPrice'TransformQuantity :: (GHC.Maybe.Maybe InvoiceitemPrice'TransformQuantity'),
    -- | type: One of \`one_time\` or \`recurring\` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
    InvoiceitemPrice' -> Maybe InvoiceitemPrice'Type'
invoiceitemPrice'Type :: (GHC.Maybe.Maybe InvoiceitemPrice'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\`.
    InvoiceitemPrice' -> Maybe Int
invoiceitemPrice'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\`.
    InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'UnitAmountDecimal :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> InvoiceitemPrice' -> ShowS
[InvoiceitemPrice'] -> ShowS
InvoiceitemPrice' -> String
(Int -> InvoiceitemPrice' -> ShowS)
-> (InvoiceitemPrice' -> String)
-> ([InvoiceitemPrice'] -> ShowS)
-> Show InvoiceitemPrice'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'] -> ShowS
$cshowList :: [InvoiceitemPrice'] -> ShowS
show :: InvoiceitemPrice' -> String
$cshow :: InvoiceitemPrice' -> String
showsPrec :: Int -> InvoiceitemPrice' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice' -> ShowS
GHC.Show.Show,
      InvoiceitemPrice' -> InvoiceitemPrice' -> Bool
(InvoiceitemPrice' -> InvoiceitemPrice' -> Bool)
-> (InvoiceitemPrice' -> InvoiceitemPrice' -> Bool)
-> Eq InvoiceitemPrice'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice' -> InvoiceitemPrice' -> Bool
$c/= :: InvoiceitemPrice' -> InvoiceitemPrice' -> Bool
== :: InvoiceitemPrice' -> InvoiceitemPrice' -> Bool
$c== :: InvoiceitemPrice' -> InvoiceitemPrice' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceitemPrice' where
  toJSON :: InvoiceitemPrice' -> Value
toJSON InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Bool
invoiceitemPrice'Active InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"billing_scheme" Text -> Maybe InvoiceitemPrice'BillingScheme' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'BillingScheme'
invoiceitemPrice'BillingScheme InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Int
invoiceitemPrice'Created InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Currency InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Id InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Bool
invoiceitemPrice'Livemode InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'LookupKey InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Object
invoiceitemPrice'Metadata InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Nickname InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"product" Text -> Maybe InvoiceitemPrice'Product'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'Product'Variants
invoiceitemPrice'Product InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"recurring" Text -> Maybe InvoiceitemPrice'Recurring' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'Recurring'
invoiceitemPrice'Recurring InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_behavior" Text -> Maybe InvoiceitemPrice'TaxBehavior' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'TaxBehavior'
invoiceitemPrice'TaxBehavior InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe [PriceTier]
invoiceitemPrice'Tiers InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tiers_mode" Text -> Maybe InvoiceitemPrice'TiersMode' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'TiersMode'
invoiceitemPrice'TiersMode InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"transform_quantity" Text -> Maybe InvoiceitemPrice'TransformQuantity' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'TransformQuantity'
invoiceitemPrice'TransformQuantity InvoiceitemPrice'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> Maybe InvoiceitemPrice'Type' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'Type'
invoiceitemPrice'Type InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Int
invoiceitemPrice'UnitAmount InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'UnitAmountDecimal InvoiceitemPrice'
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
"price" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: InvoiceitemPrice' -> Encoding
toEncoding InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Bool
invoiceitemPrice'Active InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"billing_scheme" Text -> Maybe InvoiceitemPrice'BillingScheme' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'BillingScheme'
invoiceitemPrice'BillingScheme InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Int
invoiceitemPrice'Created InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Currency InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Id InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Bool
invoiceitemPrice'Livemode InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'LookupKey InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Object
invoiceitemPrice'Metadata InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'Nickname InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"product" Text -> Maybe InvoiceitemPrice'Product'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'Product'Variants
invoiceitemPrice'Product InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"recurring" Text -> Maybe InvoiceitemPrice'Recurring' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'Recurring'
invoiceitemPrice'Recurring InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_behavior" Text -> Maybe InvoiceitemPrice'TaxBehavior' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'TaxBehavior'
invoiceitemPrice'TaxBehavior InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe [PriceTier]
invoiceitemPrice'Tiers InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tiers_mode" Text -> Maybe InvoiceitemPrice'TiersMode' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'TiersMode'
invoiceitemPrice'TiersMode InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"transform_quantity" Text -> Maybe InvoiceitemPrice'TransformQuantity' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'TransformQuantity'
invoiceitemPrice'TransformQuantity InvoiceitemPrice'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> Maybe InvoiceitemPrice'Type' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice' -> Maybe InvoiceitemPrice'Type'
invoiceitemPrice'Type InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Int
invoiceitemPrice'UnitAmount InvoiceitemPrice'
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..= InvoiceitemPrice' -> Maybe Text
invoiceitemPrice'UnitAmountDecimal InvoiceitemPrice'
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
"price")))))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice' where
  parseJSON :: Value -> Parser InvoiceitemPrice'
parseJSON = String
-> (Object -> Parser InvoiceitemPrice')
-> Value
-> Parser InvoiceitemPrice'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"InvoiceitemPrice'" (\Object
obj -> ((((((((((((((((((Maybe Bool
 -> Maybe InvoiceitemPrice'BillingScheme'
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Object
 -> Maybe Text
 -> Maybe InvoiceitemPrice'Product'Variants
 -> Maybe InvoiceitemPrice'Recurring'
 -> Maybe InvoiceitemPrice'TaxBehavior'
 -> Maybe [PriceTier]
 -> Maybe InvoiceitemPrice'TiersMode'
 -> Maybe InvoiceitemPrice'TransformQuantity'
 -> Maybe InvoiceitemPrice'Type'
 -> Maybe Int
 -> Maybe Text
 -> InvoiceitemPrice')
-> Parser
     (Maybe Bool
      -> Maybe InvoiceitemPrice'BillingScheme'
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe InvoiceitemPrice'BillingScheme'
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Object
-> Maybe Text
-> Maybe InvoiceitemPrice'Product'Variants
-> Maybe InvoiceitemPrice'Recurring'
-> Maybe InvoiceitemPrice'TaxBehavior'
-> Maybe [PriceTier]
-> Maybe InvoiceitemPrice'TiersMode'
-> Maybe InvoiceitemPrice'TransformQuantity'
-> Maybe InvoiceitemPrice'Type'
-> Maybe Int
-> Maybe Text
-> InvoiceitemPrice'
InvoiceitemPrice' Parser
  (Maybe Bool
   -> Maybe InvoiceitemPrice'BillingScheme'
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Bool)
-> Parser
     (Maybe InvoiceitemPrice'BillingScheme'
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'BillingScheme'
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Object
   -> Maybe Text
   -> Maybe InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'BillingScheme')
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice'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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe Object
      -> Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Object)
-> Parser
     (Maybe Text
      -> Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe Text)
-> Parser
     (Maybe InvoiceitemPrice'Product'Variants
      -> Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'Product'Variants
   -> Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'Product'Variants)
-> Parser
     (Maybe InvoiceitemPrice'Recurring'
      -> Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice'Product'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"product")) Parser
  (Maybe InvoiceitemPrice'Recurring'
   -> Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'Recurring')
-> Parser
     (Maybe InvoiceitemPrice'TaxBehavior'
      -> Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice'Recurring')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"recurring")) Parser
  (Maybe InvoiceitemPrice'TaxBehavior'
   -> Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'TaxBehavior')
-> Parser
     (Maybe [PriceTier]
      -> Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice'TaxBehavior')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_behavior")) Parser
  (Maybe [PriceTier]
   -> Maybe InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe [PriceTier])
-> Parser
     (Maybe InvoiceitemPrice'TiersMode'
      -> Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
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 InvoiceitemPrice'TiersMode'
   -> Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'TiersMode')
-> Parser
     (Maybe InvoiceitemPrice'TransformQuantity'
      -> Maybe InvoiceitemPrice'Type'
      -> Maybe Int
      -> Maybe Text
      -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice'TiersMode')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tiers_mode")) Parser
  (Maybe InvoiceitemPrice'TransformQuantity'
   -> Maybe InvoiceitemPrice'Type'
   -> Maybe Int
   -> Maybe Text
   -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'TransformQuantity')
-> Parser
     (Maybe InvoiceitemPrice'Type'
      -> Maybe Int -> Maybe Text -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe InvoiceitemPrice'TransformQuantity')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"transform_quantity")) Parser
  (Maybe InvoiceitemPrice'Type'
   -> Maybe Int -> Maybe Text -> InvoiceitemPrice')
-> Parser (Maybe InvoiceitemPrice'Type')
-> Parser (Maybe Int -> Maybe Text -> InvoiceitemPrice')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe InvoiceitemPrice'Type')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"type")) Parser (Maybe Int -> Maybe Text -> InvoiceitemPrice')
-> Parser (Maybe Int) -> Parser (Maybe Text -> InvoiceitemPrice')
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 -> InvoiceitemPrice')
-> Parser (Maybe Text) -> Parser InvoiceitemPrice'
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 'InvoiceitemPrice'' with all required fields.
mkInvoiceitemPrice' :: InvoiceitemPrice'
mkInvoiceitemPrice' :: InvoiceitemPrice'
mkInvoiceitemPrice' =
  InvoiceitemPrice' :: Maybe Bool
-> Maybe InvoiceitemPrice'BillingScheme'
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Object
-> Maybe Text
-> Maybe InvoiceitemPrice'Product'Variants
-> Maybe InvoiceitemPrice'Recurring'
-> Maybe InvoiceitemPrice'TaxBehavior'
-> Maybe [PriceTier]
-> Maybe InvoiceitemPrice'TiersMode'
-> Maybe InvoiceitemPrice'TransformQuantity'
-> Maybe InvoiceitemPrice'Type'
-> Maybe Int
-> Maybe Text
-> InvoiceitemPrice'
InvoiceitemPrice'
    { invoiceitemPrice'Active :: Maybe Bool
invoiceitemPrice'Active = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'BillingScheme :: Maybe InvoiceitemPrice'BillingScheme'
invoiceitemPrice'BillingScheme = Maybe InvoiceitemPrice'BillingScheme'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Created :: Maybe Int
invoiceitemPrice'Created = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Currency :: Maybe Text
invoiceitemPrice'Currency = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Id :: Maybe Text
invoiceitemPrice'Id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Livemode :: Maybe Bool
invoiceitemPrice'Livemode = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'LookupKey :: Maybe Text
invoiceitemPrice'LookupKey = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Metadata :: Maybe Object
invoiceitemPrice'Metadata = Maybe Object
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Nickname :: Maybe Text
invoiceitemPrice'Nickname = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Product :: Maybe InvoiceitemPrice'Product'Variants
invoiceitemPrice'Product = Maybe InvoiceitemPrice'Product'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Recurring :: Maybe InvoiceitemPrice'Recurring'
invoiceitemPrice'Recurring = Maybe InvoiceitemPrice'Recurring'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'TaxBehavior :: Maybe InvoiceitemPrice'TaxBehavior'
invoiceitemPrice'TaxBehavior = Maybe InvoiceitemPrice'TaxBehavior'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Tiers :: Maybe [PriceTier]
invoiceitemPrice'Tiers = Maybe [PriceTier]
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'TiersMode :: Maybe InvoiceitemPrice'TiersMode'
invoiceitemPrice'TiersMode = Maybe InvoiceitemPrice'TiersMode'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'TransformQuantity :: Maybe InvoiceitemPrice'TransformQuantity'
invoiceitemPrice'TransformQuantity = Maybe InvoiceitemPrice'TransformQuantity'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Type :: Maybe InvoiceitemPrice'Type'
invoiceitemPrice'Type = Maybe InvoiceitemPrice'Type'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'UnitAmount :: Maybe Int
invoiceitemPrice'UnitAmount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'UnitAmountDecimal :: Maybe Text
invoiceitemPrice'UnitAmountDecimal = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'BillingScheme'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'BillingScheme'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"per_unit"@
    InvoiceitemPrice'BillingScheme'EnumPerUnit
  | -- | Represents the JSON value @"tiered"@
    InvoiceitemPrice'BillingScheme'EnumTiered
  deriving (Int -> InvoiceitemPrice'BillingScheme' -> ShowS
[InvoiceitemPrice'BillingScheme'] -> ShowS
InvoiceitemPrice'BillingScheme' -> String
(Int -> InvoiceitemPrice'BillingScheme' -> ShowS)
-> (InvoiceitemPrice'BillingScheme' -> String)
-> ([InvoiceitemPrice'BillingScheme'] -> ShowS)
-> Show InvoiceitemPrice'BillingScheme'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'BillingScheme'] -> ShowS
$cshowList :: [InvoiceitemPrice'BillingScheme'] -> ShowS
show :: InvoiceitemPrice'BillingScheme' -> String
$cshow :: InvoiceitemPrice'BillingScheme' -> String
showsPrec :: Int -> InvoiceitemPrice'BillingScheme' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'BillingScheme' -> ShowS
GHC.Show.Show, InvoiceitemPrice'BillingScheme'
-> InvoiceitemPrice'BillingScheme' -> Bool
(InvoiceitemPrice'BillingScheme'
 -> InvoiceitemPrice'BillingScheme' -> Bool)
-> (InvoiceitemPrice'BillingScheme'
    -> InvoiceitemPrice'BillingScheme' -> Bool)
-> Eq InvoiceitemPrice'BillingScheme'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'BillingScheme'
-> InvoiceitemPrice'BillingScheme' -> Bool
$c/= :: InvoiceitemPrice'BillingScheme'
-> InvoiceitemPrice'BillingScheme' -> Bool
== :: InvoiceitemPrice'BillingScheme'
-> InvoiceitemPrice'BillingScheme' -> Bool
$c== :: InvoiceitemPrice'BillingScheme'
-> InvoiceitemPrice'BillingScheme' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'BillingScheme' where
  parseJSON :: Value -> Parser InvoiceitemPrice'BillingScheme'
parseJSON Value
val =
    InvoiceitemPrice'BillingScheme'
-> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'BillingScheme'
InvoiceitemPrice'BillingScheme'EnumPerUnit
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"tiered" -> InvoiceitemPrice'BillingScheme'
InvoiceitemPrice'BillingScheme'EnumTiered
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'BillingScheme'
InvoiceitemPrice'BillingScheme'Other Value
val
      )

-- | Defines the oneOf schema located at @components.schemas.invoiceitem.properties.price.anyOf.properties.product.anyOf@ in the specification.
--
-- The ID of the product this price is associated with.
data InvoiceitemPrice'Product'Variants
  = InvoiceitemPrice'Product'Text Data.Text.Internal.Text
  | InvoiceitemPrice'Product'Product Product
  | InvoiceitemPrice'Product'DeletedProduct DeletedProduct
  deriving (Int -> InvoiceitemPrice'Product'Variants -> ShowS
[InvoiceitemPrice'Product'Variants] -> ShowS
InvoiceitemPrice'Product'Variants -> String
(Int -> InvoiceitemPrice'Product'Variants -> ShowS)
-> (InvoiceitemPrice'Product'Variants -> String)
-> ([InvoiceitemPrice'Product'Variants] -> ShowS)
-> Show InvoiceitemPrice'Product'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'Product'Variants] -> ShowS
$cshowList :: [InvoiceitemPrice'Product'Variants] -> ShowS
show :: InvoiceitemPrice'Product'Variants -> String
$cshow :: InvoiceitemPrice'Product'Variants -> String
showsPrec :: Int -> InvoiceitemPrice'Product'Variants -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'Product'Variants -> ShowS
GHC.Show.Show, InvoiceitemPrice'Product'Variants
-> InvoiceitemPrice'Product'Variants -> Bool
(InvoiceitemPrice'Product'Variants
 -> InvoiceitemPrice'Product'Variants -> Bool)
-> (InvoiceitemPrice'Product'Variants
    -> InvoiceitemPrice'Product'Variants -> Bool)
-> Eq InvoiceitemPrice'Product'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'Product'Variants
-> InvoiceitemPrice'Product'Variants -> Bool
$c/= :: InvoiceitemPrice'Product'Variants
-> InvoiceitemPrice'Product'Variants -> Bool
== :: InvoiceitemPrice'Product'Variants
-> InvoiceitemPrice'Product'Variants -> Bool
$c== :: InvoiceitemPrice'Product'Variants
-> InvoiceitemPrice'Product'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceitemPrice'Product'Variants where
  toJSON :: InvoiceitemPrice'Product'Variants -> Value
toJSON (InvoiceitemPrice'Product'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (InvoiceitemPrice'Product'Product Product
a) = Product -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Product
a
  toJSON (InvoiceitemPrice'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 InvoiceitemPrice'Product'Variants where
  parseJSON :: Value -> Parser InvoiceitemPrice'Product'Variants
parseJSON Value
val = case (Text -> InvoiceitemPrice'Product'Variants
InvoiceitemPrice'Product'Text (Text -> InvoiceitemPrice'Product'Variants)
-> Result Text -> Result InvoiceitemPrice'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 InvoiceitemPrice'Product'Variants
-> Result InvoiceitemPrice'Product'Variants
-> Result InvoiceitemPrice'Product'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Product -> InvoiceitemPrice'Product'Variants
InvoiceitemPrice'Product'Product (Product -> InvoiceitemPrice'Product'Variants)
-> Result Product -> Result InvoiceitemPrice'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 InvoiceitemPrice'Product'Variants
-> Result InvoiceitemPrice'Product'Variants
-> Result InvoiceitemPrice'Product'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((DeletedProduct -> InvoiceitemPrice'Product'Variants
InvoiceitemPrice'Product'DeletedProduct (DeletedProduct -> InvoiceitemPrice'Product'Variants)
-> Result DeletedProduct
-> Result InvoiceitemPrice'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 InvoiceitemPrice'Product'Variants
-> Result InvoiceitemPrice'Product'Variants
-> Result InvoiceitemPrice'Product'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result InvoiceitemPrice'Product'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched")) of
    Data.Aeson.Types.Internal.Success InvoiceitemPrice'Product'Variants
a -> InvoiceitemPrice'Product'Variants
-> Parser InvoiceitemPrice'Product'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure InvoiceitemPrice'Product'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser InvoiceitemPrice'Product'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the object schema located at @components.schemas.invoiceitem.properties.price.anyOf.properties.recurring.anyOf@ in the specification.
--
-- The recurring components of a price such as \\\`interval\\\` and \\\`usage_type\\\`.
data InvoiceitemPrice'Recurring' = InvoiceitemPrice'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\`.
    InvoiceitemPrice'Recurring'
-> Maybe InvoiceitemPrice'Recurring'AggregateUsage'
invoiceitemPrice'Recurring'AggregateUsage :: (GHC.Maybe.Maybe InvoiceitemPrice'Recurring'AggregateUsage'),
    -- | interval: The frequency at which a subscription is billed. One of \`day\`, \`week\`, \`month\` or \`year\`.
    InvoiceitemPrice'Recurring'
-> Maybe InvoiceitemPrice'Recurring'Interval'
invoiceitemPrice'Recurring'Interval :: (GHC.Maybe.Maybe InvoiceitemPrice'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.
    InvoiceitemPrice'Recurring' -> Maybe Int
invoiceitemPrice'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\`.
    InvoiceitemPrice'Recurring'
-> Maybe InvoiceitemPrice'Recurring'UsageType'
invoiceitemPrice'Recurring'UsageType :: (GHC.Maybe.Maybe InvoiceitemPrice'Recurring'UsageType')
  }
  deriving
    ( Int -> InvoiceitemPrice'Recurring' -> ShowS
[InvoiceitemPrice'Recurring'] -> ShowS
InvoiceitemPrice'Recurring' -> String
(Int -> InvoiceitemPrice'Recurring' -> ShowS)
-> (InvoiceitemPrice'Recurring' -> String)
-> ([InvoiceitemPrice'Recurring'] -> ShowS)
-> Show InvoiceitemPrice'Recurring'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'Recurring'] -> ShowS
$cshowList :: [InvoiceitemPrice'Recurring'] -> ShowS
show :: InvoiceitemPrice'Recurring' -> String
$cshow :: InvoiceitemPrice'Recurring' -> String
showsPrec :: Int -> InvoiceitemPrice'Recurring' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'Recurring' -> ShowS
GHC.Show.Show,
      InvoiceitemPrice'Recurring' -> InvoiceitemPrice'Recurring' -> Bool
(InvoiceitemPrice'Recurring'
 -> InvoiceitemPrice'Recurring' -> Bool)
-> (InvoiceitemPrice'Recurring'
    -> InvoiceitemPrice'Recurring' -> Bool)
-> Eq InvoiceitemPrice'Recurring'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'Recurring' -> InvoiceitemPrice'Recurring' -> Bool
$c/= :: InvoiceitemPrice'Recurring' -> InvoiceitemPrice'Recurring' -> Bool
== :: InvoiceitemPrice'Recurring' -> InvoiceitemPrice'Recurring' -> Bool
$c== :: InvoiceitemPrice'Recurring' -> InvoiceitemPrice'Recurring' -> Bool
GHC.Classes.Eq
    )

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

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

-- | Create a new 'InvoiceitemPrice'Recurring'' with all required fields.
mkInvoiceitemPrice'Recurring' :: InvoiceitemPrice'Recurring'
mkInvoiceitemPrice'Recurring' :: InvoiceitemPrice'Recurring'
mkInvoiceitemPrice'Recurring' =
  InvoiceitemPrice'Recurring' :: Maybe InvoiceitemPrice'Recurring'AggregateUsage'
-> Maybe InvoiceitemPrice'Recurring'Interval'
-> Maybe Int
-> Maybe InvoiceitemPrice'Recurring'UsageType'
-> InvoiceitemPrice'Recurring'
InvoiceitemPrice'Recurring'
    { invoiceitemPrice'Recurring'AggregateUsage :: Maybe InvoiceitemPrice'Recurring'AggregateUsage'
invoiceitemPrice'Recurring'AggregateUsage = Maybe InvoiceitemPrice'Recurring'AggregateUsage'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Recurring'Interval :: Maybe InvoiceitemPrice'Recurring'Interval'
invoiceitemPrice'Recurring'Interval = Maybe InvoiceitemPrice'Recurring'Interval'
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Recurring'IntervalCount :: Maybe Int
invoiceitemPrice'Recurring'IntervalCount = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'Recurring'UsageType :: Maybe InvoiceitemPrice'Recurring'UsageType'
invoiceitemPrice'Recurring'UsageType = Maybe InvoiceitemPrice'Recurring'UsageType'
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'Recurring'AggregateUsage'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'Recurring'AggregateUsage'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"last_during_period"@
    InvoiceitemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod
  | -- | Represents the JSON value @"last_ever"@
    InvoiceitemPrice'Recurring'AggregateUsage'EnumLastEver
  | -- | Represents the JSON value @"max"@
    InvoiceitemPrice'Recurring'AggregateUsage'EnumMax
  | -- | Represents the JSON value @"sum"@
    InvoiceitemPrice'Recurring'AggregateUsage'EnumSum
  deriving (Int -> InvoiceitemPrice'Recurring'AggregateUsage' -> ShowS
[InvoiceitemPrice'Recurring'AggregateUsage'] -> ShowS
InvoiceitemPrice'Recurring'AggregateUsage' -> String
(Int -> InvoiceitemPrice'Recurring'AggregateUsage' -> ShowS)
-> (InvoiceitemPrice'Recurring'AggregateUsage' -> String)
-> ([InvoiceitemPrice'Recurring'AggregateUsage'] -> ShowS)
-> Show InvoiceitemPrice'Recurring'AggregateUsage'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'Recurring'AggregateUsage'] -> ShowS
$cshowList :: [InvoiceitemPrice'Recurring'AggregateUsage'] -> ShowS
show :: InvoiceitemPrice'Recurring'AggregateUsage' -> String
$cshow :: InvoiceitemPrice'Recurring'AggregateUsage' -> String
showsPrec :: Int -> InvoiceitemPrice'Recurring'AggregateUsage' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'Recurring'AggregateUsage' -> ShowS
GHC.Show.Show, InvoiceitemPrice'Recurring'AggregateUsage'
-> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool
(InvoiceitemPrice'Recurring'AggregateUsage'
 -> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool)
-> (InvoiceitemPrice'Recurring'AggregateUsage'
    -> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool)
-> Eq InvoiceitemPrice'Recurring'AggregateUsage'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'Recurring'AggregateUsage'
-> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool
$c/= :: InvoiceitemPrice'Recurring'AggregateUsage'
-> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool
== :: InvoiceitemPrice'Recurring'AggregateUsage'
-> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool
$c== :: InvoiceitemPrice'Recurring'AggregateUsage'
-> InvoiceitemPrice'Recurring'AggregateUsage' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'Recurring'AggregateUsage' where
  parseJSON :: Value -> Parser InvoiceitemPrice'Recurring'AggregateUsage'
parseJSON Value
val =
    InvoiceitemPrice'Recurring'AggregateUsage'
-> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'Recurring'AggregateUsage'
InvoiceitemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"last_ever" -> InvoiceitemPrice'Recurring'AggregateUsage'
InvoiceitemPrice'Recurring'AggregateUsage'EnumLastEver
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"max" -> InvoiceitemPrice'Recurring'AggregateUsage'
InvoiceitemPrice'Recurring'AggregateUsage'EnumMax
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sum" -> InvoiceitemPrice'Recurring'AggregateUsage'
InvoiceitemPrice'Recurring'AggregateUsage'EnumSum
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'Recurring'AggregateUsage'
InvoiceitemPrice'Recurring'AggregateUsage'Other Value
val
      )

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'Recurring'Interval'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'Recurring'Interval'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"day"@
    InvoiceitemPrice'Recurring'Interval'EnumDay
  | -- | Represents the JSON value @"month"@
    InvoiceitemPrice'Recurring'Interval'EnumMonth
  | -- | Represents the JSON value @"week"@
    InvoiceitemPrice'Recurring'Interval'EnumWeek
  | -- | Represents the JSON value @"year"@
    InvoiceitemPrice'Recurring'Interval'EnumYear
  deriving (Int -> InvoiceitemPrice'Recurring'Interval' -> ShowS
[InvoiceitemPrice'Recurring'Interval'] -> ShowS
InvoiceitemPrice'Recurring'Interval' -> String
(Int -> InvoiceitemPrice'Recurring'Interval' -> ShowS)
-> (InvoiceitemPrice'Recurring'Interval' -> String)
-> ([InvoiceitemPrice'Recurring'Interval'] -> ShowS)
-> Show InvoiceitemPrice'Recurring'Interval'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'Recurring'Interval'] -> ShowS
$cshowList :: [InvoiceitemPrice'Recurring'Interval'] -> ShowS
show :: InvoiceitemPrice'Recurring'Interval' -> String
$cshow :: InvoiceitemPrice'Recurring'Interval' -> String
showsPrec :: Int -> InvoiceitemPrice'Recurring'Interval' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'Recurring'Interval' -> ShowS
GHC.Show.Show, InvoiceitemPrice'Recurring'Interval'
-> InvoiceitemPrice'Recurring'Interval' -> Bool
(InvoiceitemPrice'Recurring'Interval'
 -> InvoiceitemPrice'Recurring'Interval' -> Bool)
-> (InvoiceitemPrice'Recurring'Interval'
    -> InvoiceitemPrice'Recurring'Interval' -> Bool)
-> Eq InvoiceitemPrice'Recurring'Interval'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'Recurring'Interval'
-> InvoiceitemPrice'Recurring'Interval' -> Bool
$c/= :: InvoiceitemPrice'Recurring'Interval'
-> InvoiceitemPrice'Recurring'Interval' -> Bool
== :: InvoiceitemPrice'Recurring'Interval'
-> InvoiceitemPrice'Recurring'Interval' -> Bool
$c== :: InvoiceitemPrice'Recurring'Interval'
-> InvoiceitemPrice'Recurring'Interval' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'Recurring'Interval' where
  parseJSON :: Value -> Parser InvoiceitemPrice'Recurring'Interval'
parseJSON Value
val =
    InvoiceitemPrice'Recurring'Interval'
-> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'Recurring'Interval'
InvoiceitemPrice'Recurring'Interval'EnumDay
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"month" -> InvoiceitemPrice'Recurring'Interval'
InvoiceitemPrice'Recurring'Interval'EnumMonth
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"week" -> InvoiceitemPrice'Recurring'Interval'
InvoiceitemPrice'Recurring'Interval'EnumWeek
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"year" -> InvoiceitemPrice'Recurring'Interval'
InvoiceitemPrice'Recurring'Interval'EnumYear
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'Recurring'Interval'
InvoiceitemPrice'Recurring'Interval'Other Value
val
      )

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'Recurring'UsageType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'Recurring'UsageType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"licensed"@
    InvoiceitemPrice'Recurring'UsageType'EnumLicensed
  | -- | Represents the JSON value @"metered"@
    InvoiceitemPrice'Recurring'UsageType'EnumMetered
  deriving (Int -> InvoiceitemPrice'Recurring'UsageType' -> ShowS
[InvoiceitemPrice'Recurring'UsageType'] -> ShowS
InvoiceitemPrice'Recurring'UsageType' -> String
(Int -> InvoiceitemPrice'Recurring'UsageType' -> ShowS)
-> (InvoiceitemPrice'Recurring'UsageType' -> String)
-> ([InvoiceitemPrice'Recurring'UsageType'] -> ShowS)
-> Show InvoiceitemPrice'Recurring'UsageType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'Recurring'UsageType'] -> ShowS
$cshowList :: [InvoiceitemPrice'Recurring'UsageType'] -> ShowS
show :: InvoiceitemPrice'Recurring'UsageType' -> String
$cshow :: InvoiceitemPrice'Recurring'UsageType' -> String
showsPrec :: Int -> InvoiceitemPrice'Recurring'UsageType' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'Recurring'UsageType' -> ShowS
GHC.Show.Show, InvoiceitemPrice'Recurring'UsageType'
-> InvoiceitemPrice'Recurring'UsageType' -> Bool
(InvoiceitemPrice'Recurring'UsageType'
 -> InvoiceitemPrice'Recurring'UsageType' -> Bool)
-> (InvoiceitemPrice'Recurring'UsageType'
    -> InvoiceitemPrice'Recurring'UsageType' -> Bool)
-> Eq InvoiceitemPrice'Recurring'UsageType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'Recurring'UsageType'
-> InvoiceitemPrice'Recurring'UsageType' -> Bool
$c/= :: InvoiceitemPrice'Recurring'UsageType'
-> InvoiceitemPrice'Recurring'UsageType' -> Bool
== :: InvoiceitemPrice'Recurring'UsageType'
-> InvoiceitemPrice'Recurring'UsageType' -> Bool
$c== :: InvoiceitemPrice'Recurring'UsageType'
-> InvoiceitemPrice'Recurring'UsageType' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'Recurring'UsageType' where
  parseJSON :: Value -> Parser InvoiceitemPrice'Recurring'UsageType'
parseJSON Value
val =
    InvoiceitemPrice'Recurring'UsageType'
-> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'Recurring'UsageType'
InvoiceitemPrice'Recurring'UsageType'EnumLicensed
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"metered" -> InvoiceitemPrice'Recurring'UsageType'
InvoiceitemPrice'Recurring'UsageType'EnumMetered
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'Recurring'UsageType'
InvoiceitemPrice'Recurring'UsageType'Other Value
val
      )

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'TaxBehavior'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'TaxBehavior'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"exclusive"@
    InvoiceitemPrice'TaxBehavior'EnumExclusive
  | -- | Represents the JSON value @"inclusive"@
    InvoiceitemPrice'TaxBehavior'EnumInclusive
  | -- | Represents the JSON value @"unspecified"@
    InvoiceitemPrice'TaxBehavior'EnumUnspecified
  deriving (Int -> InvoiceitemPrice'TaxBehavior' -> ShowS
[InvoiceitemPrice'TaxBehavior'] -> ShowS
InvoiceitemPrice'TaxBehavior' -> String
(Int -> InvoiceitemPrice'TaxBehavior' -> ShowS)
-> (InvoiceitemPrice'TaxBehavior' -> String)
-> ([InvoiceitemPrice'TaxBehavior'] -> ShowS)
-> Show InvoiceitemPrice'TaxBehavior'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'TaxBehavior'] -> ShowS
$cshowList :: [InvoiceitemPrice'TaxBehavior'] -> ShowS
show :: InvoiceitemPrice'TaxBehavior' -> String
$cshow :: InvoiceitemPrice'TaxBehavior' -> String
showsPrec :: Int -> InvoiceitemPrice'TaxBehavior' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'TaxBehavior' -> ShowS
GHC.Show.Show, InvoiceitemPrice'TaxBehavior'
-> InvoiceitemPrice'TaxBehavior' -> Bool
(InvoiceitemPrice'TaxBehavior'
 -> InvoiceitemPrice'TaxBehavior' -> Bool)
-> (InvoiceitemPrice'TaxBehavior'
    -> InvoiceitemPrice'TaxBehavior' -> Bool)
-> Eq InvoiceitemPrice'TaxBehavior'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'TaxBehavior'
-> InvoiceitemPrice'TaxBehavior' -> Bool
$c/= :: InvoiceitemPrice'TaxBehavior'
-> InvoiceitemPrice'TaxBehavior' -> Bool
== :: InvoiceitemPrice'TaxBehavior'
-> InvoiceitemPrice'TaxBehavior' -> Bool
$c== :: InvoiceitemPrice'TaxBehavior'
-> InvoiceitemPrice'TaxBehavior' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'TaxBehavior' where
  parseJSON :: Value -> Parser InvoiceitemPrice'TaxBehavior'
parseJSON Value
val =
    InvoiceitemPrice'TaxBehavior'
-> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'TaxBehavior'
InvoiceitemPrice'TaxBehavior'EnumExclusive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inclusive" -> InvoiceitemPrice'TaxBehavior'
InvoiceitemPrice'TaxBehavior'EnumInclusive
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"unspecified" -> InvoiceitemPrice'TaxBehavior'
InvoiceitemPrice'TaxBehavior'EnumUnspecified
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'TaxBehavior'
InvoiceitemPrice'TaxBehavior'Other Value
val
      )

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'TiersMode'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'TiersMode'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"graduated"@
    InvoiceitemPrice'TiersMode'EnumGraduated
  | -- | Represents the JSON value @"volume"@
    InvoiceitemPrice'TiersMode'EnumVolume
  deriving (Int -> InvoiceitemPrice'TiersMode' -> ShowS
[InvoiceitemPrice'TiersMode'] -> ShowS
InvoiceitemPrice'TiersMode' -> String
(Int -> InvoiceitemPrice'TiersMode' -> ShowS)
-> (InvoiceitemPrice'TiersMode' -> String)
-> ([InvoiceitemPrice'TiersMode'] -> ShowS)
-> Show InvoiceitemPrice'TiersMode'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'TiersMode'] -> ShowS
$cshowList :: [InvoiceitemPrice'TiersMode'] -> ShowS
show :: InvoiceitemPrice'TiersMode' -> String
$cshow :: InvoiceitemPrice'TiersMode' -> String
showsPrec :: Int -> InvoiceitemPrice'TiersMode' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'TiersMode' -> ShowS
GHC.Show.Show, InvoiceitemPrice'TiersMode' -> InvoiceitemPrice'TiersMode' -> Bool
(InvoiceitemPrice'TiersMode'
 -> InvoiceitemPrice'TiersMode' -> Bool)
-> (InvoiceitemPrice'TiersMode'
    -> InvoiceitemPrice'TiersMode' -> Bool)
-> Eq InvoiceitemPrice'TiersMode'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'TiersMode' -> InvoiceitemPrice'TiersMode' -> Bool
$c/= :: InvoiceitemPrice'TiersMode' -> InvoiceitemPrice'TiersMode' -> Bool
== :: InvoiceitemPrice'TiersMode' -> InvoiceitemPrice'TiersMode' -> Bool
$c== :: InvoiceitemPrice'TiersMode' -> InvoiceitemPrice'TiersMode' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'TiersMode' where
  parseJSON :: Value -> Parser InvoiceitemPrice'TiersMode'
parseJSON Value
val =
    InvoiceitemPrice'TiersMode' -> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'TiersMode'
InvoiceitemPrice'TiersMode'EnumGraduated
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"volume" -> InvoiceitemPrice'TiersMode'
InvoiceitemPrice'TiersMode'EnumVolume
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'TiersMode'
InvoiceitemPrice'TiersMode'Other Value
val
      )

-- | Defines the object schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'TransformQuantity' = InvoiceitemPrice'TransformQuantity'
  { -- | divide_by: Divide usage by this number.
    InvoiceitemPrice'TransformQuantity' -> Maybe Int
invoiceitemPrice'TransformQuantity'DivideBy :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | round: After division, either round the result \`up\` or \`down\`.
    InvoiceitemPrice'TransformQuantity'
-> Maybe InvoiceitemPrice'TransformQuantity'Round'
invoiceitemPrice'TransformQuantity'Round :: (GHC.Maybe.Maybe InvoiceitemPrice'TransformQuantity'Round')
  }
  deriving
    ( Int -> InvoiceitemPrice'TransformQuantity' -> ShowS
[InvoiceitemPrice'TransformQuantity'] -> ShowS
InvoiceitemPrice'TransformQuantity' -> String
(Int -> InvoiceitemPrice'TransformQuantity' -> ShowS)
-> (InvoiceitemPrice'TransformQuantity' -> String)
-> ([InvoiceitemPrice'TransformQuantity'] -> ShowS)
-> Show InvoiceitemPrice'TransformQuantity'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'TransformQuantity'] -> ShowS
$cshowList :: [InvoiceitemPrice'TransformQuantity'] -> ShowS
show :: InvoiceitemPrice'TransformQuantity' -> String
$cshow :: InvoiceitemPrice'TransformQuantity' -> String
showsPrec :: Int -> InvoiceitemPrice'TransformQuantity' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'TransformQuantity' -> ShowS
GHC.Show.Show,
      InvoiceitemPrice'TransformQuantity'
-> InvoiceitemPrice'TransformQuantity' -> Bool
(InvoiceitemPrice'TransformQuantity'
 -> InvoiceitemPrice'TransformQuantity' -> Bool)
-> (InvoiceitemPrice'TransformQuantity'
    -> InvoiceitemPrice'TransformQuantity' -> Bool)
-> Eq InvoiceitemPrice'TransformQuantity'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'TransformQuantity'
-> InvoiceitemPrice'TransformQuantity' -> Bool
$c/= :: InvoiceitemPrice'TransformQuantity'
-> InvoiceitemPrice'TransformQuantity' -> Bool
== :: InvoiceitemPrice'TransformQuantity'
-> InvoiceitemPrice'TransformQuantity' -> Bool
$c== :: InvoiceitemPrice'TransformQuantity'
-> InvoiceitemPrice'TransformQuantity' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceitemPrice'TransformQuantity' where
  toJSON :: InvoiceitemPrice'TransformQuantity' -> Value
toJSON InvoiceitemPrice'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..= InvoiceitemPrice'TransformQuantity' -> Maybe Int
invoiceitemPrice'TransformQuantity'DivideBy InvoiceitemPrice'TransformQuantity'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"round" Text -> Maybe InvoiceitemPrice'TransformQuantity'Round' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice'TransformQuantity'
-> Maybe InvoiceitemPrice'TransformQuantity'Round'
invoiceitemPrice'TransformQuantity'Round InvoiceitemPrice'TransformQuantity'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: InvoiceitemPrice'TransformQuantity' -> Encoding
toEncoding InvoiceitemPrice'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..= InvoiceitemPrice'TransformQuantity' -> Maybe Int
invoiceitemPrice'TransformQuantity'DivideBy InvoiceitemPrice'TransformQuantity'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"round" Text -> Maybe InvoiceitemPrice'TransformQuantity'Round' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= InvoiceitemPrice'TransformQuantity'
-> Maybe InvoiceitemPrice'TransformQuantity'Round'
invoiceitemPrice'TransformQuantity'Round InvoiceitemPrice'TransformQuantity'
obj))

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

-- | Create a new 'InvoiceitemPrice'TransformQuantity'' with all required fields.
mkInvoiceitemPrice'TransformQuantity' :: InvoiceitemPrice'TransformQuantity'
mkInvoiceitemPrice'TransformQuantity' :: InvoiceitemPrice'TransformQuantity'
mkInvoiceitemPrice'TransformQuantity' =
  InvoiceitemPrice'TransformQuantity' :: Maybe Int
-> Maybe InvoiceitemPrice'TransformQuantity'Round'
-> InvoiceitemPrice'TransformQuantity'
InvoiceitemPrice'TransformQuantity'
    { invoiceitemPrice'TransformQuantity'DivideBy :: Maybe Int
invoiceitemPrice'TransformQuantity'DivideBy = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      invoiceitemPrice'TransformQuantity'Round :: Maybe InvoiceitemPrice'TransformQuantity'Round'
invoiceitemPrice'TransformQuantity'Round = Maybe InvoiceitemPrice'TransformQuantity'Round'
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.invoiceitem.properties.price.anyOf.properties.transform_quantity.anyOf.properties.round@ in the specification.
--
-- After division, either round the result \`up\` or \`down\`.
data InvoiceitemPrice'TransformQuantity'Round'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'TransformQuantity'Round'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"down"@
    InvoiceitemPrice'TransformQuantity'Round'EnumDown
  | -- | Represents the JSON value @"up"@
    InvoiceitemPrice'TransformQuantity'Round'EnumUp
  deriving (Int -> InvoiceitemPrice'TransformQuantity'Round' -> ShowS
[InvoiceitemPrice'TransformQuantity'Round'] -> ShowS
InvoiceitemPrice'TransformQuantity'Round' -> String
(Int -> InvoiceitemPrice'TransformQuantity'Round' -> ShowS)
-> (InvoiceitemPrice'TransformQuantity'Round' -> String)
-> ([InvoiceitemPrice'TransformQuantity'Round'] -> ShowS)
-> Show InvoiceitemPrice'TransformQuantity'Round'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'TransformQuantity'Round'] -> ShowS
$cshowList :: [InvoiceitemPrice'TransformQuantity'Round'] -> ShowS
show :: InvoiceitemPrice'TransformQuantity'Round' -> String
$cshow :: InvoiceitemPrice'TransformQuantity'Round' -> String
showsPrec :: Int -> InvoiceitemPrice'TransformQuantity'Round' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'TransformQuantity'Round' -> ShowS
GHC.Show.Show, InvoiceitemPrice'TransformQuantity'Round'
-> InvoiceitemPrice'TransformQuantity'Round' -> Bool
(InvoiceitemPrice'TransformQuantity'Round'
 -> InvoiceitemPrice'TransformQuantity'Round' -> Bool)
-> (InvoiceitemPrice'TransformQuantity'Round'
    -> InvoiceitemPrice'TransformQuantity'Round' -> Bool)
-> Eq InvoiceitemPrice'TransformQuantity'Round'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'TransformQuantity'Round'
-> InvoiceitemPrice'TransformQuantity'Round' -> Bool
$c/= :: InvoiceitemPrice'TransformQuantity'Round'
-> InvoiceitemPrice'TransformQuantity'Round' -> Bool
== :: InvoiceitemPrice'TransformQuantity'Round'
-> InvoiceitemPrice'TransformQuantity'Round' -> Bool
$c== :: InvoiceitemPrice'TransformQuantity'Round'
-> InvoiceitemPrice'TransformQuantity'Round' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'TransformQuantity'Round' where
  parseJSON :: Value -> Parser InvoiceitemPrice'TransformQuantity'Round'
parseJSON Value
val =
    InvoiceitemPrice'TransformQuantity'Round'
-> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'TransformQuantity'Round'
InvoiceitemPrice'TransformQuantity'Round'EnumDown
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"up" -> InvoiceitemPrice'TransformQuantity'Round'
InvoiceitemPrice'TransformQuantity'Round'EnumUp
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'TransformQuantity'Round'
InvoiceitemPrice'TransformQuantity'Round'Other Value
val
      )

-- | Defines the enum schema located at @components.schemas.invoiceitem.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 InvoiceitemPrice'Type'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    InvoiceitemPrice'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.
    InvoiceitemPrice'Type'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"one_time"@
    InvoiceitemPrice'Type'EnumOneTime
  | -- | Represents the JSON value @"recurring"@
    InvoiceitemPrice'Type'EnumRecurring
  deriving (Int -> InvoiceitemPrice'Type' -> ShowS
[InvoiceitemPrice'Type'] -> ShowS
InvoiceitemPrice'Type' -> String
(Int -> InvoiceitemPrice'Type' -> ShowS)
-> (InvoiceitemPrice'Type' -> String)
-> ([InvoiceitemPrice'Type'] -> ShowS)
-> Show InvoiceitemPrice'Type'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemPrice'Type'] -> ShowS
$cshowList :: [InvoiceitemPrice'Type'] -> ShowS
show :: InvoiceitemPrice'Type' -> String
$cshow :: InvoiceitemPrice'Type' -> String
showsPrec :: Int -> InvoiceitemPrice'Type' -> ShowS
$cshowsPrec :: Int -> InvoiceitemPrice'Type' -> ShowS
GHC.Show.Show, InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool
(InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool)
-> (InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool)
-> Eq InvoiceitemPrice'Type'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool
$c/= :: InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool
== :: InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool
$c== :: InvoiceitemPrice'Type' -> InvoiceitemPrice'Type' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemPrice'Type' where
  parseJSON :: Value -> Parser InvoiceitemPrice'Type'
parseJSON Value
val =
    InvoiceitemPrice'Type' -> Parser InvoiceitemPrice'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" -> InvoiceitemPrice'Type'
InvoiceitemPrice'Type'EnumOneTime
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"recurring" -> InvoiceitemPrice'Type'
InvoiceitemPrice'Type'EnumRecurring
            | Bool
GHC.Base.otherwise -> Value -> InvoiceitemPrice'Type'
InvoiceitemPrice'Type'Other Value
val
      )

-- | Defines the oneOf schema located at @components.schemas.invoiceitem.properties.subscription.anyOf@ in the specification.
--
-- The subscription that this invoice item has been created for, if any.
data InvoiceitemSubscription'Variants
  = InvoiceitemSubscription'Text Data.Text.Internal.Text
  | InvoiceitemSubscription'Subscription Subscription
  deriving (Int -> InvoiceitemSubscription'Variants -> ShowS
[InvoiceitemSubscription'Variants] -> ShowS
InvoiceitemSubscription'Variants -> String
(Int -> InvoiceitemSubscription'Variants -> ShowS)
-> (InvoiceitemSubscription'Variants -> String)
-> ([InvoiceitemSubscription'Variants] -> ShowS)
-> Show InvoiceitemSubscription'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvoiceitemSubscription'Variants] -> ShowS
$cshowList :: [InvoiceitemSubscription'Variants] -> ShowS
show :: InvoiceitemSubscription'Variants -> String
$cshow :: InvoiceitemSubscription'Variants -> String
showsPrec :: Int -> InvoiceitemSubscription'Variants -> ShowS
$cshowsPrec :: Int -> InvoiceitemSubscription'Variants -> ShowS
GHC.Show.Show, InvoiceitemSubscription'Variants
-> InvoiceitemSubscription'Variants -> Bool
(InvoiceitemSubscription'Variants
 -> InvoiceitemSubscription'Variants -> Bool)
-> (InvoiceitemSubscription'Variants
    -> InvoiceitemSubscription'Variants -> Bool)
-> Eq InvoiceitemSubscription'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvoiceitemSubscription'Variants
-> InvoiceitemSubscription'Variants -> Bool
$c/= :: InvoiceitemSubscription'Variants
-> InvoiceitemSubscription'Variants -> Bool
== :: InvoiceitemSubscription'Variants
-> InvoiceitemSubscription'Variants -> Bool
$c== :: InvoiceitemSubscription'Variants
-> InvoiceitemSubscription'Variants -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON InvoiceitemSubscription'Variants where
  parseJSON :: Value -> Parser InvoiceitemSubscription'Variants
parseJSON Value
val = case (Text -> InvoiceitemSubscription'Variants
InvoiceitemSubscription'Text (Text -> InvoiceitemSubscription'Variants)
-> Result Text -> Result InvoiceitemSubscription'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 InvoiceitemSubscription'Variants
-> Result InvoiceitemSubscription'Variants
-> Result InvoiceitemSubscription'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Subscription -> InvoiceitemSubscription'Variants
InvoiceitemSubscription'Subscription (Subscription -> InvoiceitemSubscription'Variants)
-> Result Subscription -> Result InvoiceitemSubscription'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Subscription
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result InvoiceitemSubscription'Variants
-> Result InvoiceitemSubscription'Variants
-> Result InvoiceitemSubscription'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result InvoiceitemSubscription'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success InvoiceitemSubscription'Variants
a -> InvoiceitemSubscription'Variants
-> Parser InvoiceitemSubscription'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure InvoiceitemSubscription'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser InvoiceitemSubscription'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a