{-# 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 LineItem
module StripeAPI.Types.LineItem where

import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified StripeAPI.Common
import StripeAPI.TypeAlias
import {-# SOURCE #-} StripeAPI.Types.DeletedProduct
import {-# SOURCE #-} StripeAPI.Types.Discount
import {-# SOURCE #-} StripeAPI.Types.DiscountsResourceDiscountAmount
import {-# SOURCE #-} StripeAPI.Types.InvoiceLineItemPeriod
import {-# SOURCE #-} StripeAPI.Types.InvoiceTaxAmount
import {-# SOURCE #-} StripeAPI.Types.Price
import {-# SOURCE #-} StripeAPI.Types.PriceTier
import {-# SOURCE #-} StripeAPI.Types.Product
import {-# SOURCE #-} StripeAPI.Types.Recurring
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.line_item@ in the specification.
data LineItem = LineItem
  { -- | amount: The amount, in %s.
    LineItem -> Int
lineItemAmount :: 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).
    LineItem -> Text
lineItemCurrency :: Data.Text.Internal.Text,
    -- | description: An arbitrary string attached to the object. Often useful for displaying to users.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LineItem -> Maybe Text
lineItemDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | discount_amounts: The amount of discount calculated per discount for this line item.
    LineItem -> Maybe [DiscountsResourceDiscountAmount]
lineItemDiscountAmounts :: (GHC.Maybe.Maybe ([DiscountsResourceDiscountAmount])),
    -- | discountable: If true, discounts will apply to this line item. Always false for prorations.
    LineItem -> Bool
lineItemDiscountable :: GHC.Types.Bool,
    -- | discounts: The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use \`expand[]=discounts\` to expand each discount.
    LineItem -> Maybe [LineItemDiscounts'Variants]
lineItemDiscounts :: (GHC.Maybe.Maybe ([LineItemDiscounts'Variants])),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LineItem -> Text
lineItemId :: Data.Text.Internal.Text,
    -- | invoice_item: The ID of the [invoice item](https:\/\/stripe.com\/docs\/api\/invoiceitems) associated with this line item if any.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LineItem -> Maybe Text
lineItemInvoiceItem :: (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.
    LineItem -> Bool
lineItemLivemode :: 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. Note that for line items with \`type=subscription\` this will reflect the metadata of the subscription that caused the line item to be created.
    LineItem -> Object
lineItemMetadata :: Data.Aeson.Types.Internal.Object,
    -- | period:
    LineItem -> InvoiceLineItemPeriod
lineItemPeriod :: InvoiceLineItemPeriod,
    -- | price: The price of the line item.
    LineItem -> Maybe LineItemPrice'
lineItemPrice :: (GHC.Maybe.Maybe LineItemPrice'),
    -- | proration: Whether this is a proration.
    LineItem -> Bool
lineItemProration :: GHC.Types.Bool,
    -- | quantity: The quantity of the subscription, if the line item is a subscription or a proration.
    LineItem -> Maybe Int
lineItemQuantity :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | subscription: The subscription that the invoice item pertains to, if any.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LineItem -> Maybe Text
lineItemSubscription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | subscription_item: The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LineItem -> Maybe Text
lineItemSubscriptionItem :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | tax_amounts: The amount of tax calculated per tax rate for this line item
    LineItem -> Maybe [InvoiceTaxAmount]
lineItemTaxAmounts :: (GHC.Maybe.Maybe ([InvoiceTaxAmount])),
    -- | tax_rates: The tax rates which apply to the line item.
    LineItem -> Maybe [TaxRate]
lineItemTaxRates :: (GHC.Maybe.Maybe ([TaxRate])),
    -- | type: A string identifying the type of the source of this line item, either an \`invoiceitem\` or a \`subscription\`.
    LineItem -> LineItemType'
lineItemType :: LineItemType'
  }
  deriving
    ( Int -> LineItem -> ShowS
[LineItem] -> ShowS
LineItem -> String
(Int -> LineItem -> ShowS)
-> (LineItem -> String) -> ([LineItem] -> ShowS) -> Show LineItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItem] -> ShowS
$cshowList :: [LineItem] -> ShowS
show :: LineItem -> String
$cshow :: LineItem -> String
showsPrec :: Int -> LineItem -> ShowS
$cshowsPrec :: Int -> LineItem -> ShowS
GHC.Show.Show,
      LineItem -> LineItem -> Bool
(LineItem -> LineItem -> Bool)
-> (LineItem -> LineItem -> Bool) -> Eq LineItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItem -> LineItem -> Bool
$c/= :: LineItem -> LineItem -> Bool
== :: LineItem -> LineItem -> Bool
$c== :: LineItem -> LineItem -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON LineItem where
  toJSON :: LineItem -> Value
toJSON LineItem
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..= LineItem -> Int
lineItemAmount LineItem
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..= LineItem -> Text
lineItemCurrency LineItem
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..= LineItem -> Maybe Text
lineItemDescription LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discount_amounts" Text -> Maybe [DiscountsResourceDiscountAmount] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe [DiscountsResourceDiscountAmount]
lineItemDiscountAmounts LineItem
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..= LineItem -> Bool
lineItemDiscountable LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"discounts" Text -> Maybe [LineItemDiscounts'Variants] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe [LineItemDiscounts'Variants]
lineItemDiscounts LineItem
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..= LineItem -> Text
lineItemId LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"invoice_item" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe Text
lineItemInvoiceItem LineItem
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..= LineItem -> Bool
lineItemLivemode LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Object
lineItemMetadata LineItem
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..= LineItem -> InvoiceLineItemPeriod
lineItemPeriod LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"price" Text -> Maybe LineItemPrice' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe LineItemPrice'
lineItemPrice LineItem
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..= LineItem -> Bool
lineItemProration LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"quantity" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe Int
lineItemQuantity LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"subscription" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe Text
lineItemSubscription LineItem
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..= LineItem -> Maybe Text
lineItemSubscriptionItem LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_amounts" Text -> Maybe [InvoiceTaxAmount] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe [InvoiceTaxAmount]
lineItemTaxAmounts LineItem
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..= LineItem -> Maybe [TaxRate]
lineItemTaxRates LineItem
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> LineItemType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> LineItemType'
lineItemType LineItem
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
"line_item" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: LineItem -> Encoding
toEncoding LineItem
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..= LineItem -> Int
lineItemAmount LineItem
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..= LineItem -> Text
lineItemCurrency LineItem
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..= LineItem -> Maybe Text
lineItemDescription LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discount_amounts" Text -> Maybe [DiscountsResourceDiscountAmount] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe [DiscountsResourceDiscountAmount]
lineItemDiscountAmounts LineItem
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..= LineItem -> Bool
lineItemDiscountable LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"discounts" Text -> Maybe [LineItemDiscounts'Variants] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe [LineItemDiscounts'Variants]
lineItemDiscounts LineItem
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..= LineItem -> Text
lineItemId LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"invoice_item" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe Text
lineItemInvoiceItem LineItem
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..= LineItem -> Bool
lineItemLivemode LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Object
lineItemMetadata LineItem
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..= LineItem -> InvoiceLineItemPeriod
lineItemPeriod LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"price" Text -> Maybe LineItemPrice' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe LineItemPrice'
lineItemPrice LineItem
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..= LineItem -> Bool
lineItemProration LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"quantity" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe Int
lineItemQuantity LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"subscription" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe Text
lineItemSubscription LineItem
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..= LineItem -> Maybe Text
lineItemSubscriptionItem LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_amounts" Text -> Maybe [InvoiceTaxAmount] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> Maybe [InvoiceTaxAmount]
lineItemTaxAmounts LineItem
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..= LineItem -> Maybe [TaxRate]
lineItemTaxRates LineItem
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> LineItemType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LineItem -> LineItemType'
lineItemType LineItem
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
"line_item"))))))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON LineItem where
  parseJSON :: Value -> Parser LineItem
parseJSON = String -> (Object -> Parser LineItem) -> Value -> Parser LineItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"LineItem" (\Object
obj -> (((((((((((((((((((Int
 -> Text
 -> Maybe Text
 -> Maybe [DiscountsResourceDiscountAmount]
 -> Bool
 -> Maybe [LineItemDiscounts'Variants]
 -> Text
 -> Maybe Text
 -> Bool
 -> Object
 -> InvoiceLineItemPeriod
 -> Maybe LineItemPrice'
 -> Bool
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe [InvoiceTaxAmount]
 -> Maybe [TaxRate]
 -> LineItemType'
 -> LineItem)
-> Parser
     (Int
      -> Text
      -> Maybe Text
      -> Maybe [DiscountsResourceDiscountAmount]
      -> Bool
      -> Maybe [LineItemDiscounts'Variants]
      -> Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Int
-> Text
-> Maybe Text
-> Maybe [DiscountsResourceDiscountAmount]
-> Bool
-> Maybe [LineItemDiscounts'Variants]
-> Text
-> Maybe Text
-> Bool
-> Object
-> InvoiceLineItemPeriod
-> Maybe LineItemPrice'
-> Bool
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [InvoiceTaxAmount]
-> Maybe [TaxRate]
-> LineItemType'
-> LineItem
LineItem Parser
  (Int
   -> Text
   -> Maybe Text
   -> Maybe [DiscountsResourceDiscountAmount]
   -> Bool
   -> Maybe [LineItemDiscounts'Variants]
   -> Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Int
-> Parser
     (Text
      -> Maybe Text
      -> Maybe [DiscountsResourceDiscountAmount]
      -> Bool
      -> Maybe [LineItemDiscounts'Variants]
      -> Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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
   -> Maybe Text
   -> Maybe [DiscountsResourceDiscountAmount]
   -> Bool
   -> Maybe [LineItemDiscounts'Variants]
   -> Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe [DiscountsResourceDiscountAmount]
      -> Bool
      -> Maybe [LineItemDiscounts'Variants]
      -> Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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
  (Maybe Text
   -> Maybe [DiscountsResourceDiscountAmount]
   -> Bool
   -> Maybe [LineItemDiscounts'Variants]
   -> Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe [DiscountsResourceDiscountAmount]
      -> Bool
      -> Maybe [LineItemDiscounts'Variants]
      -> Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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
  (Maybe [DiscountsResourceDiscountAmount]
   -> Bool
   -> Maybe [LineItemDiscounts'Variants]
   -> Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe [DiscountsResourceDiscountAmount])
-> Parser
     (Bool
      -> Maybe [LineItemDiscounts'Variants]
      -> Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [DiscountsResourceDiscountAmount])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"discount_amounts")) Parser
  (Bool
   -> Maybe [LineItemDiscounts'Variants]
   -> Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Bool
-> Parser
     (Maybe [LineItemDiscounts'Variants]
      -> Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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 [LineItemDiscounts'Variants]
   -> Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe [LineItemDiscounts'Variants])
-> Parser
     (Text
      -> Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [LineItemDiscounts'Variants])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"discounts")) Parser
  (Text
   -> Maybe Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Text
-> Parser
     (Maybe Text
      -> Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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 Text
   -> Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe Text)
-> Parser
     (Bool
      -> Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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
"invoice_item")) Parser
  (Bool
   -> Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Bool
-> Parser
     (Object
      -> InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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
  (Object
   -> InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Object
-> Parser
     (InvoiceLineItemPeriod
      -> Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Object
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"metadata")) Parser
  (InvoiceLineItemPeriod
   -> Maybe LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser InvoiceLineItemPeriod
-> Parser
     (Maybe LineItemPrice'
      -> Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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 LineItemPrice'
   -> Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe LineItemPrice')
-> Parser
     (Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe LineItemPrice')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"price")) Parser
  (Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser Bool
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"quantity")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate]
      -> LineItemType'
      -> LineItem)
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")) Parser
  (Maybe Text
   -> Maybe [InvoiceTaxAmount]
   -> Maybe [TaxRate]
   -> LineItemType'
   -> LineItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe [InvoiceTaxAmount]
      -> Maybe [TaxRate] -> LineItemType' -> LineItem)
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 [InvoiceTaxAmount]
   -> Maybe [TaxRate] -> LineItemType' -> LineItem)
-> Parser (Maybe [InvoiceTaxAmount])
-> Parser (Maybe [TaxRate] -> LineItemType' -> LineItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [InvoiceTaxAmount])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_amounts")) Parser (Maybe [TaxRate] -> LineItemType' -> LineItem)
-> Parser (Maybe [TaxRate]) -> Parser (LineItemType' -> LineItem)
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 (LineItemType' -> LineItem)
-> Parser LineItemType' -> Parser LineItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser LineItemType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"type"))

-- | Create a new 'LineItem' with all required fields.
mkLineItem ::
  -- | 'lineItemAmount'
  GHC.Types.Int ->
  -- | 'lineItemCurrency'
  Data.Text.Internal.Text ->
  -- | 'lineItemDiscountable'
  GHC.Types.Bool ->
  -- | 'lineItemId'
  Data.Text.Internal.Text ->
  -- | 'lineItemLivemode'
  GHC.Types.Bool ->
  -- | 'lineItemMetadata'
  Data.Aeson.Types.Internal.Object ->
  -- | 'lineItemPeriod'
  InvoiceLineItemPeriod ->
  -- | 'lineItemProration'
  GHC.Types.Bool ->
  -- | 'lineItemType'
  LineItemType' ->
  LineItem
mkLineItem :: Int
-> Text
-> Bool
-> Text
-> Bool
-> Object
-> InvoiceLineItemPeriod
-> Bool
-> LineItemType'
-> LineItem
mkLineItem Int
lineItemAmount Text
lineItemCurrency Bool
lineItemDiscountable Text
lineItemId Bool
lineItemLivemode Object
lineItemMetadata InvoiceLineItemPeriod
lineItemPeriod Bool
lineItemProration LineItemType'
lineItemType =
  LineItem :: Int
-> Text
-> Maybe Text
-> Maybe [DiscountsResourceDiscountAmount]
-> Bool
-> Maybe [LineItemDiscounts'Variants]
-> Text
-> Maybe Text
-> Bool
-> Object
-> InvoiceLineItemPeriod
-> Maybe LineItemPrice'
-> Bool
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [InvoiceTaxAmount]
-> Maybe [TaxRate]
-> LineItemType'
-> LineItem
LineItem
    { lineItemAmount :: Int
lineItemAmount = Int
lineItemAmount,
      lineItemCurrency :: Text
lineItemCurrency = Text
lineItemCurrency,
      lineItemDescription :: Maybe Text
lineItemDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemDiscountAmounts :: Maybe [DiscountsResourceDiscountAmount]
lineItemDiscountAmounts = Maybe [DiscountsResourceDiscountAmount]
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemDiscountable :: Bool
lineItemDiscountable = Bool
lineItemDiscountable,
      lineItemDiscounts :: Maybe [LineItemDiscounts'Variants]
lineItemDiscounts = Maybe [LineItemDiscounts'Variants]
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemId :: Text
lineItemId = Text
lineItemId,
      lineItemInvoiceItem :: Maybe Text
lineItemInvoiceItem = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemLivemode :: Bool
lineItemLivemode = Bool
lineItemLivemode,
      lineItemMetadata :: Object
lineItemMetadata = Object
lineItemMetadata,
      lineItemPeriod :: InvoiceLineItemPeriod
lineItemPeriod = InvoiceLineItemPeriod
lineItemPeriod,
      lineItemPrice :: Maybe LineItemPrice'
lineItemPrice = Maybe LineItemPrice'
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemProration :: Bool
lineItemProration = Bool
lineItemProration,
      lineItemQuantity :: Maybe Int
lineItemQuantity = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemSubscription :: Maybe Text
lineItemSubscription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemSubscriptionItem :: Maybe Text
lineItemSubscriptionItem = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemTaxAmounts :: Maybe [InvoiceTaxAmount]
lineItemTaxAmounts = Maybe [InvoiceTaxAmount]
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemTaxRates :: Maybe [TaxRate]
lineItemTaxRates = Maybe [TaxRate]
forall a. Maybe a
GHC.Maybe.Nothing,
      lineItemType :: LineItemType'
lineItemType = LineItemType'
lineItemType
    }

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

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

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

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

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.billing_scheme@ in the specification.
--
-- Describes how to compute the price per period. Either \`per_unit\` or \`tiered\`. \`per_unit\` indicates that the fixed amount (specified in \`unit_amount\` or \`unit_amount_decimal\`) will be charged per unit in \`quantity\` (for prices with \`usage_type=licensed\`), or per unit of total usage (for prices with \`usage_type=metered\`). \`tiered\` indicates that the unit pricing will be computed using a tiering strategy as defined using the \`tiers\` and \`tiers_mode\` attributes.
data LineItemPrice'BillingScheme'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'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.
    LineItemPrice'BillingScheme'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"per_unit"@
    LineItemPrice'BillingScheme'EnumPerUnit
  | -- | Represents the JSON value @"tiered"@
    LineItemPrice'BillingScheme'EnumTiered
  deriving (Int -> LineItemPrice'BillingScheme' -> ShowS
[LineItemPrice'BillingScheme'] -> ShowS
LineItemPrice'BillingScheme' -> String
(Int -> LineItemPrice'BillingScheme' -> ShowS)
-> (LineItemPrice'BillingScheme' -> String)
-> ([LineItemPrice'BillingScheme'] -> ShowS)
-> Show LineItemPrice'BillingScheme'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'BillingScheme'] -> ShowS
$cshowList :: [LineItemPrice'BillingScheme'] -> ShowS
show :: LineItemPrice'BillingScheme' -> String
$cshow :: LineItemPrice'BillingScheme' -> String
showsPrec :: Int -> LineItemPrice'BillingScheme' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'BillingScheme' -> ShowS
GHC.Show.Show, LineItemPrice'BillingScheme'
-> LineItemPrice'BillingScheme' -> Bool
(LineItemPrice'BillingScheme'
 -> LineItemPrice'BillingScheme' -> Bool)
-> (LineItemPrice'BillingScheme'
    -> LineItemPrice'BillingScheme' -> Bool)
-> Eq LineItemPrice'BillingScheme'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'BillingScheme'
-> LineItemPrice'BillingScheme' -> Bool
$c/= :: LineItemPrice'BillingScheme'
-> LineItemPrice'BillingScheme' -> Bool
== :: LineItemPrice'BillingScheme'
-> LineItemPrice'BillingScheme' -> Bool
$c== :: LineItemPrice'BillingScheme'
-> LineItemPrice'BillingScheme' -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.object@ in the specification.
--
-- String representing the object\'s type. Objects of the same type share the same value.
data LineItemPrice'Object'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'Object'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    LineItemPrice'Object'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"price"@
    LineItemPrice'Object'EnumPrice
  deriving (Int -> LineItemPrice'Object' -> ShowS
[LineItemPrice'Object'] -> ShowS
LineItemPrice'Object' -> String
(Int -> LineItemPrice'Object' -> ShowS)
-> (LineItemPrice'Object' -> String)
-> ([LineItemPrice'Object'] -> ShowS)
-> Show LineItemPrice'Object'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'Object'] -> ShowS
$cshowList :: [LineItemPrice'Object'] -> ShowS
show :: LineItemPrice'Object' -> String
$cshow :: LineItemPrice'Object' -> String
showsPrec :: Int -> LineItemPrice'Object' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'Object' -> ShowS
GHC.Show.Show, LineItemPrice'Object' -> LineItemPrice'Object' -> Bool
(LineItemPrice'Object' -> LineItemPrice'Object' -> Bool)
-> (LineItemPrice'Object' -> LineItemPrice'Object' -> Bool)
-> Eq LineItemPrice'Object'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'Object' -> LineItemPrice'Object' -> Bool
$c/= :: LineItemPrice'Object' -> LineItemPrice'Object' -> Bool
== :: LineItemPrice'Object' -> LineItemPrice'Object' -> Bool
$c== :: LineItemPrice'Object' -> LineItemPrice'Object' -> Bool
GHC.Classes.Eq)

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

instance Data.Aeson.Types.FromJSON.FromJSON LineItemPrice'Object' where
  parseJSON :: Value -> Parser LineItemPrice'Object'
parseJSON Value
val =
    LineItemPrice'Object' -> Parser LineItemPrice'Object'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"price" -> LineItemPrice'Object'
LineItemPrice'Object'EnumPrice
            | Bool
GHC.Base.otherwise -> Value -> LineItemPrice'Object'
LineItemPrice'Object'Other Value
val
      )

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

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

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

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

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.recurring.anyOf.properties.aggregate_usage@ in the specification.
--
-- Specifies a usage aggregation strategy for prices of \`usage_type=metered\`. Allowed values are \`sum\` for summing up all usage during a period, \`last_during_period\` for using the last usage record reported within a period, \`last_ever\` for using the last usage record ever (across period bounds) or \`max\` which uses the usage record with the maximum reported usage during a period. Defaults to \`sum\`.
data LineItemPrice'Recurring'AggregateUsage'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'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.
    LineItemPrice'Recurring'AggregateUsage'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"last_during_period"@
    LineItemPrice'Recurring'AggregateUsage'EnumLastDuringPeriod
  | -- | Represents the JSON value @"last_ever"@
    LineItemPrice'Recurring'AggregateUsage'EnumLastEver
  | -- | Represents the JSON value @"max"@
    LineItemPrice'Recurring'AggregateUsage'EnumMax
  | -- | Represents the JSON value @"sum"@
    LineItemPrice'Recurring'AggregateUsage'EnumSum
  deriving (Int -> LineItemPrice'Recurring'AggregateUsage' -> ShowS
[LineItemPrice'Recurring'AggregateUsage'] -> ShowS
LineItemPrice'Recurring'AggregateUsage' -> String
(Int -> LineItemPrice'Recurring'AggregateUsage' -> ShowS)
-> (LineItemPrice'Recurring'AggregateUsage' -> String)
-> ([LineItemPrice'Recurring'AggregateUsage'] -> ShowS)
-> Show LineItemPrice'Recurring'AggregateUsage'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'Recurring'AggregateUsage'] -> ShowS
$cshowList :: [LineItemPrice'Recurring'AggregateUsage'] -> ShowS
show :: LineItemPrice'Recurring'AggregateUsage' -> String
$cshow :: LineItemPrice'Recurring'AggregateUsage' -> String
showsPrec :: Int -> LineItemPrice'Recurring'AggregateUsage' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'Recurring'AggregateUsage' -> ShowS
GHC.Show.Show, LineItemPrice'Recurring'AggregateUsage'
-> LineItemPrice'Recurring'AggregateUsage' -> Bool
(LineItemPrice'Recurring'AggregateUsage'
 -> LineItemPrice'Recurring'AggregateUsage' -> Bool)
-> (LineItemPrice'Recurring'AggregateUsage'
    -> LineItemPrice'Recurring'AggregateUsage' -> Bool)
-> Eq LineItemPrice'Recurring'AggregateUsage'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'Recurring'AggregateUsage'
-> LineItemPrice'Recurring'AggregateUsage' -> Bool
$c/= :: LineItemPrice'Recurring'AggregateUsage'
-> LineItemPrice'Recurring'AggregateUsage' -> Bool
== :: LineItemPrice'Recurring'AggregateUsage'
-> LineItemPrice'Recurring'AggregateUsage' -> Bool
$c== :: LineItemPrice'Recurring'AggregateUsage'
-> LineItemPrice'Recurring'AggregateUsage' -> Bool
GHC.Classes.Eq)

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

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

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

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.recurring.anyOf.properties.usage_type@ in the specification.
--
-- Configures how the quantity per period should be determined. Can be either \`metered\` or \`licensed\`. \`licensed\` automatically bills the \`quantity\` set when adding it to a subscription. \`metered\` aggregates the total usage based on usage records. Defaults to \`licensed\`.
data LineItemPrice'Recurring'UsageType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'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.
    LineItemPrice'Recurring'UsageType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"licensed"@
    LineItemPrice'Recurring'UsageType'EnumLicensed
  | -- | Represents the JSON value @"metered"@
    LineItemPrice'Recurring'UsageType'EnumMetered
  deriving (Int -> LineItemPrice'Recurring'UsageType' -> ShowS
[LineItemPrice'Recurring'UsageType'] -> ShowS
LineItemPrice'Recurring'UsageType' -> String
(Int -> LineItemPrice'Recurring'UsageType' -> ShowS)
-> (LineItemPrice'Recurring'UsageType' -> String)
-> ([LineItemPrice'Recurring'UsageType'] -> ShowS)
-> Show LineItemPrice'Recurring'UsageType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'Recurring'UsageType'] -> ShowS
$cshowList :: [LineItemPrice'Recurring'UsageType'] -> ShowS
show :: LineItemPrice'Recurring'UsageType' -> String
$cshow :: LineItemPrice'Recurring'UsageType' -> String
showsPrec :: Int -> LineItemPrice'Recurring'UsageType' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'Recurring'UsageType' -> ShowS
GHC.Show.Show, LineItemPrice'Recurring'UsageType'
-> LineItemPrice'Recurring'UsageType' -> Bool
(LineItemPrice'Recurring'UsageType'
 -> LineItemPrice'Recurring'UsageType' -> Bool)
-> (LineItemPrice'Recurring'UsageType'
    -> LineItemPrice'Recurring'UsageType' -> Bool)
-> Eq LineItemPrice'Recurring'UsageType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'Recurring'UsageType'
-> LineItemPrice'Recurring'UsageType' -> Bool
$c/= :: LineItemPrice'Recurring'UsageType'
-> LineItemPrice'Recurring'UsageType' -> Bool
== :: LineItemPrice'Recurring'UsageType'
-> LineItemPrice'Recurring'UsageType' -> Bool
$c== :: LineItemPrice'Recurring'UsageType'
-> LineItemPrice'Recurring'UsageType' -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.tax_behavior@ in the specification.
--
-- Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of \`inclusive\`, \`exclusive\`, or \`unspecified\`. Once specified as either \`inclusive\` or \`exclusive\`, it cannot be changed.
data LineItemPrice'TaxBehavior'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'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.
    LineItemPrice'TaxBehavior'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"exclusive"@
    LineItemPrice'TaxBehavior'EnumExclusive
  | -- | Represents the JSON value @"inclusive"@
    LineItemPrice'TaxBehavior'EnumInclusive
  | -- | Represents the JSON value @"unspecified"@
    LineItemPrice'TaxBehavior'EnumUnspecified
  deriving (Int -> LineItemPrice'TaxBehavior' -> ShowS
[LineItemPrice'TaxBehavior'] -> ShowS
LineItemPrice'TaxBehavior' -> String
(Int -> LineItemPrice'TaxBehavior' -> ShowS)
-> (LineItemPrice'TaxBehavior' -> String)
-> ([LineItemPrice'TaxBehavior'] -> ShowS)
-> Show LineItemPrice'TaxBehavior'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'TaxBehavior'] -> ShowS
$cshowList :: [LineItemPrice'TaxBehavior'] -> ShowS
show :: LineItemPrice'TaxBehavior' -> String
$cshow :: LineItemPrice'TaxBehavior' -> String
showsPrec :: Int -> LineItemPrice'TaxBehavior' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'TaxBehavior' -> ShowS
GHC.Show.Show, LineItemPrice'TaxBehavior' -> LineItemPrice'TaxBehavior' -> Bool
(LineItemPrice'TaxBehavior' -> LineItemPrice'TaxBehavior' -> Bool)
-> (LineItemPrice'TaxBehavior'
    -> LineItemPrice'TaxBehavior' -> Bool)
-> Eq LineItemPrice'TaxBehavior'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'TaxBehavior' -> LineItemPrice'TaxBehavior' -> Bool
$c/= :: LineItemPrice'TaxBehavior' -> LineItemPrice'TaxBehavior' -> Bool
== :: LineItemPrice'TaxBehavior' -> LineItemPrice'TaxBehavior' -> Bool
$c== :: LineItemPrice'TaxBehavior' -> LineItemPrice'TaxBehavior' -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.tiers_mode@ in the specification.
--
-- Defines if the tiering price should be \`graduated\` or \`volume\` based. In \`volume\`-based tiering, the maximum quantity within a period determines the per unit price. In \`graduated\` tiering, pricing can change as the quantity grows.
data LineItemPrice'TiersMode'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'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.
    LineItemPrice'TiersMode'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"graduated"@
    LineItemPrice'TiersMode'EnumGraduated
  | -- | Represents the JSON value @"volume"@
    LineItemPrice'TiersMode'EnumVolume
  deriving (Int -> LineItemPrice'TiersMode' -> ShowS
[LineItemPrice'TiersMode'] -> ShowS
LineItemPrice'TiersMode' -> String
(Int -> LineItemPrice'TiersMode' -> ShowS)
-> (LineItemPrice'TiersMode' -> String)
-> ([LineItemPrice'TiersMode'] -> ShowS)
-> Show LineItemPrice'TiersMode'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'TiersMode'] -> ShowS
$cshowList :: [LineItemPrice'TiersMode'] -> ShowS
show :: LineItemPrice'TiersMode' -> String
$cshow :: LineItemPrice'TiersMode' -> String
showsPrec :: Int -> LineItemPrice'TiersMode' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'TiersMode' -> ShowS
GHC.Show.Show, LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool
(LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool)
-> (LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool)
-> Eq LineItemPrice'TiersMode'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool
$c/= :: LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool
== :: LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool
$c== :: LineItemPrice'TiersMode' -> LineItemPrice'TiersMode' -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the object schema located at @components.schemas.line_item.properties.price.anyOf.properties.transform_quantity.anyOf@ in the specification.
--
-- Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with \\\`tiers\\\`.
data LineItemPrice'TransformQuantity' = LineItemPrice'TransformQuantity'
  { -- | divide_by: Divide usage by this number.
    LineItemPrice'TransformQuantity' -> Maybe Int
lineItemPrice'TransformQuantity'DivideBy :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | round: After division, either round the result \`up\` or \`down\`.
    LineItemPrice'TransformQuantity'
-> Maybe LineItemPrice'TransformQuantity'Round'
lineItemPrice'TransformQuantity'Round :: (GHC.Maybe.Maybe LineItemPrice'TransformQuantity'Round')
  }
  deriving
    ( Int -> LineItemPrice'TransformQuantity' -> ShowS
[LineItemPrice'TransformQuantity'] -> ShowS
LineItemPrice'TransformQuantity' -> String
(Int -> LineItemPrice'TransformQuantity' -> ShowS)
-> (LineItemPrice'TransformQuantity' -> String)
-> ([LineItemPrice'TransformQuantity'] -> ShowS)
-> Show LineItemPrice'TransformQuantity'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'TransformQuantity'] -> ShowS
$cshowList :: [LineItemPrice'TransformQuantity'] -> ShowS
show :: LineItemPrice'TransformQuantity' -> String
$cshow :: LineItemPrice'TransformQuantity' -> String
showsPrec :: Int -> LineItemPrice'TransformQuantity' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'TransformQuantity' -> ShowS
GHC.Show.Show,
      LineItemPrice'TransformQuantity'
-> LineItemPrice'TransformQuantity' -> Bool
(LineItemPrice'TransformQuantity'
 -> LineItemPrice'TransformQuantity' -> Bool)
-> (LineItemPrice'TransformQuantity'
    -> LineItemPrice'TransformQuantity' -> Bool)
-> Eq LineItemPrice'TransformQuantity'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'TransformQuantity'
-> LineItemPrice'TransformQuantity' -> Bool
$c/= :: LineItemPrice'TransformQuantity'
-> LineItemPrice'TransformQuantity' -> Bool
== :: LineItemPrice'TransformQuantity'
-> LineItemPrice'TransformQuantity' -> Bool
$c== :: LineItemPrice'TransformQuantity'
-> LineItemPrice'TransformQuantity' -> Bool
GHC.Classes.Eq
    )

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

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

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

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

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.price.anyOf.properties.type@ in the specification.
--
-- One of \`one_time\` or \`recurring\` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
data LineItemPrice'Type'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemPrice'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.
    LineItemPrice'Type'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"one_time"@
    LineItemPrice'Type'EnumOneTime
  | -- | Represents the JSON value @"recurring"@
    LineItemPrice'Type'EnumRecurring
  deriving (Int -> LineItemPrice'Type' -> ShowS
[LineItemPrice'Type'] -> ShowS
LineItemPrice'Type' -> String
(Int -> LineItemPrice'Type' -> ShowS)
-> (LineItemPrice'Type' -> String)
-> ([LineItemPrice'Type'] -> ShowS)
-> Show LineItemPrice'Type'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemPrice'Type'] -> ShowS
$cshowList :: [LineItemPrice'Type'] -> ShowS
show :: LineItemPrice'Type' -> String
$cshow :: LineItemPrice'Type' -> String
showsPrec :: Int -> LineItemPrice'Type' -> ShowS
$cshowsPrec :: Int -> LineItemPrice'Type' -> ShowS
GHC.Show.Show, LineItemPrice'Type' -> LineItemPrice'Type' -> Bool
(LineItemPrice'Type' -> LineItemPrice'Type' -> Bool)
-> (LineItemPrice'Type' -> LineItemPrice'Type' -> Bool)
-> Eq LineItemPrice'Type'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemPrice'Type' -> LineItemPrice'Type' -> Bool
$c/= :: LineItemPrice'Type' -> LineItemPrice'Type' -> Bool
== :: LineItemPrice'Type' -> LineItemPrice'Type' -> Bool
$c== :: LineItemPrice'Type' -> LineItemPrice'Type' -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the enum schema located at @components.schemas.line_item.properties.type@ in the specification.
--
-- A string identifying the type of the source of this line item, either an \`invoiceitem\` or a \`subscription\`.
data LineItemType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    LineItemType'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.
    LineItemType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"invoiceitem"@
    LineItemType'EnumInvoiceitem
  | -- | Represents the JSON value @"subscription"@
    LineItemType'EnumSubscription
  deriving (Int -> LineItemType' -> ShowS
[LineItemType'] -> ShowS
LineItemType' -> String
(Int -> LineItemType' -> ShowS)
-> (LineItemType' -> String)
-> ([LineItemType'] -> ShowS)
-> Show LineItemType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineItemType'] -> ShowS
$cshowList :: [LineItemType'] -> ShowS
show :: LineItemType' -> String
$cshow :: LineItemType' -> String
showsPrec :: Int -> LineItemType' -> ShowS
$cshowsPrec :: Int -> LineItemType' -> ShowS
GHC.Show.Show, LineItemType' -> LineItemType' -> Bool
(LineItemType' -> LineItemType' -> Bool)
-> (LineItemType' -> LineItemType' -> Bool) -> Eq LineItemType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineItemType' -> LineItemType' -> Bool
$c/= :: LineItemType' -> LineItemType' -> Bool
== :: LineItemType' -> LineItemType' -> Bool
$c== :: LineItemType' -> LineItemType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON LineItemType' where
  toJSON :: LineItemType' -> Value
toJSON (LineItemType'Other Value
val) = Value
val
  toJSON (LineItemType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (LineItemType'
LineItemType'EnumInvoiceitem) = Value
"invoiceitem"
  toJSON (LineItemType'
LineItemType'EnumSubscription) = Value
"subscription"

instance Data.Aeson.Types.FromJSON.FromJSON LineItemType' where
  parseJSON :: Value -> Parser LineItemType'
parseJSON Value
val =
    LineItemType' -> Parser LineItemType'
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
"invoiceitem" -> LineItemType'
LineItemType'EnumInvoiceitem
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"subscription" -> LineItemType'
LineItemType'EnumSubscription
            | Bool
GHC.Base.otherwise -> Value -> LineItemType'
LineItemType'Other Value
val
      )