{-# 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 Product
module StripeAPI.Types.Product 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.PackageDimensions
import {-# SOURCE #-} StripeAPI.Types.TaxCode
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.product@ in the specification.
--
-- Products describe the specific goods or services you offer to your customers.
-- For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product.
-- They can be used in conjunction with [Prices](https:\/\/stripe.com\/docs\/api\#prices) to configure pricing in Checkout and Subscriptions.
--
-- Related guides: [Set up a subscription](https:\/\/stripe.com\/docs\/billing\/subscriptions\/set-up-subscription) or accept [one-time payments with Checkout](https:\/\/stripe.com\/docs\/payments\/checkout\/client\#create-products) and more about [Products and Prices](https:\/\/stripe.com\/docs\/billing\/prices-guide)
data Product = Product
  { -- | active: Whether the product is currently available for purchase.
    Product -> Bool
productActive :: GHC.Types.Bool,
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    Product -> Int
productCreated :: GHC.Types.Int,
    -- | description: The product\'s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Product -> Maybe Text
productDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Product -> Text
productId :: Data.Text.Internal.Text,
    -- | images: A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
    Product -> [Text]
productImages :: ([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.
    Product -> Bool
productLivemode :: 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.
    Product -> Object
productMetadata :: Data.Aeson.Types.Internal.Object,
    -- | name: The product\'s name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Product -> Text
productName :: Data.Text.Internal.Text,
    -- | package_dimensions: The dimensions of this product for shipping purposes.
    Product -> Maybe ProductPackageDimensions'
productPackageDimensions :: (GHC.Maybe.Maybe ProductPackageDimensions'),
    -- | shippable: Whether this product is shipped (i.e., physical goods).
    Product -> Maybe Bool
productShippable :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | statement_descriptor: Extra information about a product which will appear on your customer\'s credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Product -> Maybe Text
productStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | tax_code: A [tax code](https:\/\/stripe.com\/docs\/tax\/tax-codes) ID.
    Product -> Maybe ProductTaxCode'Variants
productTaxCode :: (GHC.Maybe.Maybe ProductTaxCode'Variants),
    -- | unit_label: A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Product -> Maybe Text
productUnitLabel :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | updated: Time at which the object was last updated. Measured in seconds since the Unix epoch.
    Product -> Int
productUpdated :: GHC.Types.Int,
    -- | url: A URL of a publicly-accessible webpage for this product.
    --
    -- Constraints:
    --
    -- * Maximum length of 2048
    Product -> Maybe Text
productUrl :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> Product -> ShowS
[Product] -> ShowS
Product -> String
(Int -> Product -> ShowS)
-> (Product -> String) -> ([Product] -> ShowS) -> Show Product
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Product] -> ShowS
$cshowList :: [Product] -> ShowS
show :: Product -> String
$cshow :: Product -> String
showsPrec :: Int -> Product -> ShowS
$cshowsPrec :: Int -> Product -> ShowS
GHC.Show.Show,
      Product -> Product -> Bool
(Product -> Product -> Bool)
-> (Product -> Product -> Bool) -> Eq Product
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Product -> Product -> Bool
$c/= :: Product -> Product -> Bool
== :: Product -> Product -> Bool
$c== :: Product -> Product -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON Product where
  toJSON :: Product -> Value
toJSON Product
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"active" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Bool
productActive Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Int
productCreated Product
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..= Product -> Maybe Text
productDescription Product
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..= Product -> Text
productId Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"images" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> [Text]
productImages Product
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..= Product -> Bool
productLivemode Product
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..= Product -> Object
productMetadata Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Text
productName Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"package_dimensions" Text -> Maybe ProductPackageDimensions' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe ProductPackageDimensions'
productPackageDimensions Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"shippable" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Bool
productShippable Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Text
productStatementDescriptor Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"tax_code" Text -> Maybe ProductTaxCode'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe ProductTaxCode'Variants
productTaxCode Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"unit_label" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Text
productUnitLabel Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"updated" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Int
productUpdated Product
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"url" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Text
productUrl Product
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
"product" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: Product -> Encoding
toEncoding Product
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"active" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Bool
productActive Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Int
productCreated Product
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..= Product -> Maybe Text
productDescription Product
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..= Product -> Text
productId Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"images" Text -> [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> [Text]
productImages Product
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..= Product -> Bool
productLivemode Product
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..= Product -> Object
productMetadata Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"name" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Text
productName Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"package_dimensions" Text -> Maybe ProductPackageDimensions' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe ProductPackageDimensions'
productPackageDimensions Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"shippable" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Bool
productShippable Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"statement_descriptor" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Text
productStatementDescriptor Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"tax_code" Text -> Maybe ProductTaxCode'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe ProductTaxCode'Variants
productTaxCode Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"unit_label" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Text
productUnitLabel Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"updated" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Int
productUpdated Product
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"url" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Product -> Maybe Text
productUrl Product
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
"product"))))))))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON Product where
  parseJSON :: Value -> Parser Product
parseJSON = String -> (Object -> Parser Product) -> Value -> Parser Product
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Product" (\Object
obj -> (((((((((((((((Bool
 -> Int
 -> Maybe Text
 -> Text
 -> [Text]
 -> Bool
 -> Object
 -> Text
 -> Maybe ProductPackageDimensions'
 -> Maybe Bool
 -> Maybe Text
 -> Maybe ProductTaxCode'Variants
 -> Maybe Text
 -> Int
 -> Maybe Text
 -> Product)
-> Parser
     (Bool
      -> Int
      -> Maybe Text
      -> Text
      -> [Text]
      -> Bool
      -> Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Bool
-> Int
-> Maybe Text
-> Text
-> [Text]
-> Bool
-> Object
-> Text
-> Maybe ProductPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe ProductTaxCode'Variants
-> Maybe Text
-> Int
-> Maybe Text
-> Product
Product Parser
  (Bool
   -> Int
   -> Maybe Text
   -> Text
   -> [Text]
   -> Bool
   -> Object
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser Bool
-> Parser
     (Int
      -> Maybe Text
      -> Text
      -> [Text]
      -> Bool
      -> Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
"active")) Parser
  (Int
   -> Maybe Text
   -> Text
   -> [Text]
   -> Bool
   -> Object
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser Int
-> Parser
     (Maybe Text
      -> Text
      -> [Text]
      -> Bool
      -> Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
"created")) Parser
  (Maybe Text
   -> Text
   -> [Text]
   -> Bool
   -> Object
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> [Text]
      -> Bool
      -> Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
  (Text
   -> [Text]
   -> Bool
   -> Object
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser Text
-> Parser
     ([Text]
      -> Bool
      -> Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
  ([Text]
   -> Bool
   -> Object
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser [Text]
-> Parser
     (Bool
      -> Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
"images")) Parser
  (Bool
   -> Object
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser Bool
-> Parser
     (Object
      -> Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
   -> Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser Object
-> Parser
     (Text
      -> Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
  (Text
   -> Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser Text
-> Parser
     (Maybe ProductPackageDimensions'
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
"name")) Parser
  (Maybe ProductPackageDimensions'
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser (Maybe ProductPackageDimensions')
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ProductPackageDimensions')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"package_dimensions")) Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe ProductTaxCode'Variants
      -> Maybe Text
      -> Int
      -> Maybe Text
      -> Product)
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
"shippable")) Parser
  (Maybe Text
   -> Maybe ProductTaxCode'Variants
   -> Maybe Text
   -> Int
   -> Maybe Text
   -> Product)
-> Parser (Maybe Text)
-> Parser
     (Maybe ProductTaxCode'Variants
      -> Maybe Text -> Int -> Maybe Text -> Product)
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
"statement_descriptor")) Parser
  (Maybe ProductTaxCode'Variants
   -> Maybe Text -> Int -> Maybe Text -> Product)
-> Parser (Maybe ProductTaxCode'Variants)
-> Parser (Maybe Text -> Int -> Maybe Text -> Product)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe ProductTaxCode'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"tax_code")) Parser (Maybe Text -> Int -> Maybe Text -> Product)
-> Parser (Maybe Text) -> Parser (Int -> Maybe Text -> Product)
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_label")) Parser (Int -> Maybe Text -> Product)
-> Parser Int -> Parser (Maybe Text -> Product)
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
"updated")) Parser (Maybe Text -> Product)
-> Parser (Maybe Text) -> Parser Product
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
"url"))

-- | Create a new 'Product' with all required fields.
mkProduct ::
  -- | 'productActive'
  GHC.Types.Bool ->
  -- | 'productCreated'
  GHC.Types.Int ->
  -- | 'productId'
  Data.Text.Internal.Text ->
  -- | 'productImages'
  [Data.Text.Internal.Text] ->
  -- | 'productLivemode'
  GHC.Types.Bool ->
  -- | 'productMetadata'
  Data.Aeson.Types.Internal.Object ->
  -- | 'productName'
  Data.Text.Internal.Text ->
  -- | 'productUpdated'
  GHC.Types.Int ->
  Product
mkProduct :: Bool
-> Int
-> Text
-> [Text]
-> Bool
-> Object
-> Text
-> Int
-> Product
mkProduct Bool
productActive Int
productCreated Text
productId [Text]
productImages Bool
productLivemode Object
productMetadata Text
productName Int
productUpdated =
  Product :: Bool
-> Int
-> Maybe Text
-> Text
-> [Text]
-> Bool
-> Object
-> Text
-> Maybe ProductPackageDimensions'
-> Maybe Bool
-> Maybe Text
-> Maybe ProductTaxCode'Variants
-> Maybe Text
-> Int
-> Maybe Text
-> Product
Product
    { productActive :: Bool
productActive = Bool
productActive,
      productCreated :: Int
productCreated = Int
productCreated,
      productDescription :: Maybe Text
productDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      productId :: Text
productId = Text
productId,
      productImages :: [Text]
productImages = [Text]
productImages,
      productLivemode :: Bool
productLivemode = Bool
productLivemode,
      productMetadata :: Object
productMetadata = Object
productMetadata,
      productName :: Text
productName = Text
productName,
      productPackageDimensions :: Maybe ProductPackageDimensions'
productPackageDimensions = Maybe ProductPackageDimensions'
forall a. Maybe a
GHC.Maybe.Nothing,
      productShippable :: Maybe Bool
productShippable = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      productStatementDescriptor :: Maybe Text
productStatementDescriptor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      productTaxCode :: Maybe ProductTaxCode'Variants
productTaxCode = Maybe ProductTaxCode'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      productUnitLabel :: Maybe Text
productUnitLabel = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      productUpdated :: Int
productUpdated = Int
productUpdated,
      productUrl :: Maybe Text
productUrl = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the object schema located at @components.schemas.product.properties.package_dimensions.anyOf@ in the specification.
--
-- The dimensions of this product for shipping purposes.
data ProductPackageDimensions' = ProductPackageDimensions'
  { -- | height: Height, in inches.
    ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Height :: (GHC.Maybe.Maybe GHC.Types.Double),
    -- | length: Length, in inches.
    ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Length :: (GHC.Maybe.Maybe GHC.Types.Double),
    -- | weight: Weight, in ounces.
    ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Weight :: (GHC.Maybe.Maybe GHC.Types.Double),
    -- | width: Width, in inches.
    ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Width :: (GHC.Maybe.Maybe GHC.Types.Double)
  }
  deriving
    ( Int -> ProductPackageDimensions' -> ShowS
[ProductPackageDimensions'] -> ShowS
ProductPackageDimensions' -> String
(Int -> ProductPackageDimensions' -> ShowS)
-> (ProductPackageDimensions' -> String)
-> ([ProductPackageDimensions'] -> ShowS)
-> Show ProductPackageDimensions'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductPackageDimensions'] -> ShowS
$cshowList :: [ProductPackageDimensions'] -> ShowS
show :: ProductPackageDimensions' -> String
$cshow :: ProductPackageDimensions' -> String
showsPrec :: Int -> ProductPackageDimensions' -> ShowS
$cshowsPrec :: Int -> ProductPackageDimensions' -> ShowS
GHC.Show.Show,
      ProductPackageDimensions' -> ProductPackageDimensions' -> Bool
(ProductPackageDimensions' -> ProductPackageDimensions' -> Bool)
-> (ProductPackageDimensions' -> ProductPackageDimensions' -> Bool)
-> Eq ProductPackageDimensions'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductPackageDimensions' -> ProductPackageDimensions' -> Bool
$c/= :: ProductPackageDimensions' -> ProductPackageDimensions' -> Bool
== :: ProductPackageDimensions' -> ProductPackageDimensions' -> Bool
$c== :: ProductPackageDimensions' -> ProductPackageDimensions' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON ProductPackageDimensions' where
  toJSON :: ProductPackageDimensions' -> Value
toJSON ProductPackageDimensions'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"height" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Height ProductPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"length" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Length ProductPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"weight" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Weight ProductPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"width" Text -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Width ProductPackageDimensions'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: ProductPackageDimensions' -> Encoding
toEncoding ProductPackageDimensions'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"height" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Height ProductPackageDimensions'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"length" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Length ProductPackageDimensions'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"weight" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Weight ProductPackageDimensions'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"width" Text -> Maybe Double -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= ProductPackageDimensions' -> Maybe Double
productPackageDimensions'Width ProductPackageDimensions'
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON ProductPackageDimensions' where
  parseJSON :: Value -> Parser ProductPackageDimensions'
parseJSON = String
-> (Object -> Parser ProductPackageDimensions')
-> Value
-> Parser ProductPackageDimensions'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ProductPackageDimensions'" (\Object
obj -> ((((Maybe Double
 -> Maybe Double
 -> Maybe Double
 -> Maybe Double
 -> ProductPackageDimensions')
-> Parser
     (Maybe Double
      -> Maybe Double
      -> Maybe Double
      -> Maybe Double
      -> ProductPackageDimensions')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> ProductPackageDimensions'
ProductPackageDimensions' Parser
  (Maybe Double
   -> Maybe Double
   -> Maybe Double
   -> Maybe Double
   -> ProductPackageDimensions')
-> Parser (Maybe Double)
-> Parser
     (Maybe Double
      -> Maybe Double -> Maybe Double -> ProductPackageDimensions')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"height")) Parser
  (Maybe Double
   -> Maybe Double -> Maybe Double -> ProductPackageDimensions')
-> Parser (Maybe Double)
-> Parser
     (Maybe Double -> Maybe Double -> ProductPackageDimensions')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"length")) Parser (Maybe Double -> Maybe Double -> ProductPackageDimensions')
-> Parser (Maybe Double)
-> Parser (Maybe Double -> ProductPackageDimensions')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"weight")) Parser (Maybe Double -> ProductPackageDimensions')
-> Parser (Maybe Double) -> Parser ProductPackageDimensions'
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"width"))

-- | Create a new 'ProductPackageDimensions'' with all required fields.
mkProductPackageDimensions' :: ProductPackageDimensions'
mkProductPackageDimensions' :: ProductPackageDimensions'
mkProductPackageDimensions' =
  ProductPackageDimensions' :: Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> ProductPackageDimensions'
ProductPackageDimensions'
    { productPackageDimensions'Height :: Maybe Double
productPackageDimensions'Height = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing,
      productPackageDimensions'Length :: Maybe Double
productPackageDimensions'Length = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing,
      productPackageDimensions'Weight :: Maybe Double
productPackageDimensions'Weight = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing,
      productPackageDimensions'Width :: Maybe Double
productPackageDimensions'Width = Maybe Double
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @components.schemas.product.properties.tax_code.anyOf@ in the specification.
--
-- A [tax code](https:\/\/stripe.com\/docs\/tax\/tax-codes) ID.
data ProductTaxCode'Variants
  = ProductTaxCode'Text Data.Text.Internal.Text
  | ProductTaxCode'TaxCode TaxCode
  deriving (Int -> ProductTaxCode'Variants -> ShowS
[ProductTaxCode'Variants] -> ShowS
ProductTaxCode'Variants -> String
(Int -> ProductTaxCode'Variants -> ShowS)
-> (ProductTaxCode'Variants -> String)
-> ([ProductTaxCode'Variants] -> ShowS)
-> Show ProductTaxCode'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductTaxCode'Variants] -> ShowS
$cshowList :: [ProductTaxCode'Variants] -> ShowS
show :: ProductTaxCode'Variants -> String
$cshow :: ProductTaxCode'Variants -> String
showsPrec :: Int -> ProductTaxCode'Variants -> ShowS
$cshowsPrec :: Int -> ProductTaxCode'Variants -> ShowS
GHC.Show.Show, ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool
(ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool)
-> (ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool)
-> Eq ProductTaxCode'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool
$c/= :: ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool
== :: ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool
$c== :: ProductTaxCode'Variants -> ProductTaxCode'Variants -> Bool
GHC.Classes.Eq)

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

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