{-# 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 ExternalProduct
module RecurlyClient.Types.ExternalProduct 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
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as 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 RecurlyClient.Common
import RecurlyClient.TypeAlias
import {-# SOURCE #-} RecurlyClient.Types.ExternalProductReferenceMini
import {-# SOURCE #-} RecurlyClient.Types.PlanMini
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

{- | Defines the object schema located at @components.schemas.ExternalProduct@ in the specification.

Product from an external resource such as Apple App Store or Google Play Store.
-}
data ExternalProduct = ExternalProduct
    { ExternalProduct -> Maybe JsonDateTime
externalProductCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at: When the external product was created in Recurly.
    , ExternalProduct -> Maybe [ExternalProductReferenceMini]
externalProductExternal_product_references :: (GHC.Maybe.Maybe [ExternalProductReferenceMini])
    -- ^ external_product_references: List of external product references of the external product.
    , ExternalProduct -> Maybe Text
externalProductId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id: System-generated unique identifier for an external product ID, e.g. \`e28zov4fw0v2\`.
    , ExternalProduct -> Maybe Text
externalProductName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ name: Name to identify the external product in Recurly.
    , ExternalProduct -> Maybe Text
externalProductObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , ExternalProduct -> Maybe PlanMini
externalProductPlan :: (GHC.Maybe.Maybe PlanMini)
    -- ^ plan: Just the important parts.
    , ExternalProduct -> Maybe JsonDateTime
externalProductUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at: When the external product was updated in Recurly.
    }
    deriving
        ( Int -> ExternalProduct -> ShowS
[ExternalProduct] -> ShowS
ExternalProduct -> String
(Int -> ExternalProduct -> ShowS)
-> (ExternalProduct -> String)
-> ([ExternalProduct] -> ShowS)
-> Show ExternalProduct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExternalProduct -> ShowS
showsPrec :: Int -> ExternalProduct -> ShowS
$cshow :: ExternalProduct -> String
show :: ExternalProduct -> String
$cshowList :: [ExternalProduct] -> ShowS
showList :: [ExternalProduct] -> ShowS
GHC.Show.Show
        , ExternalProduct -> ExternalProduct -> Bool
(ExternalProduct -> ExternalProduct -> Bool)
-> (ExternalProduct -> ExternalProduct -> Bool)
-> Eq ExternalProduct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExternalProduct -> ExternalProduct -> Bool
== :: ExternalProduct -> ExternalProduct -> Bool
$c/= :: ExternalProduct -> ExternalProduct -> Bool
/= :: ExternalProduct -> ExternalProduct -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON ExternalProduct where
    toJSON :: ExternalProduct -> Value
toJSON ExternalProduct
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe JsonDateTime
externalProductCreated_at ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> ([ExternalProductReferenceMini] -> [Pair])
-> Maybe [ExternalProductReferenceMini]
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> ([ExternalProductReferenceMini] -> Pair)
-> [ExternalProductReferenceMini]
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_references" Key -> [ExternalProductReferenceMini] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe [ExternalProductReferenceMini]
externalProductExternal_product_references ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe Text
externalProductId ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe Text
externalProductName ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe Text
externalProductObject ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (PlanMini -> [Pair]) -> Maybe PlanMini -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (PlanMini -> Pair) -> PlanMini -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"plan" Key -> PlanMini -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe PlanMini
externalProductPlan ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe JsonDateTime
externalProductUpdated_at ExternalProduct
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: ExternalProduct -> Encoding
toEncoding ExternalProduct
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe JsonDateTime
externalProductCreated_at ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([ExternalProductReferenceMini] -> [Series])
-> Maybe [ExternalProductReferenceMini]
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> ([ExternalProductReferenceMini] -> Series)
-> [ExternalProductReferenceMini]
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"external_product_references" Key -> [ExternalProductReferenceMini] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe [ExternalProductReferenceMini]
externalProductExternal_product_references ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe Text
externalProductId ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe Text
externalProductName ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe Text
externalProductObject ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (PlanMini -> [Series]) -> Maybe PlanMini -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (PlanMini -> Series) -> PlanMini -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"plan" Key -> PlanMini -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe PlanMini
externalProductPlan ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ExternalProduct -> Maybe JsonDateTime
externalProductUpdated_at ExternalProduct
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON ExternalProduct where
    parseJSON :: Value -> Parser ExternalProduct
parseJSON = String
-> (Object -> Parser ExternalProduct)
-> Value
-> Parser ExternalProduct
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ExternalProduct" (\Object
obj -> (((((((Maybe JsonDateTime
 -> Maybe [ExternalProductReferenceMini]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe PlanMini
 -> Maybe JsonDateTime
 -> ExternalProduct)
-> Parser
     (Maybe JsonDateTime
      -> Maybe [ExternalProductReferenceMini]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe JsonDateTime
      -> ExternalProduct)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe JsonDateTime
-> Maybe [ExternalProductReferenceMini]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PlanMini
-> Maybe JsonDateTime
-> ExternalProduct
ExternalProduct Parser
  (Maybe JsonDateTime
   -> Maybe [ExternalProductReferenceMini]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe JsonDateTime
   -> ExternalProduct)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe [ExternalProductReferenceMini]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe JsonDateTime
      -> ExternalProduct)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
  (Maybe [ExternalProductReferenceMini]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe JsonDateTime
   -> ExternalProduct)
-> Parser (Maybe [ExternalProductReferenceMini])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe JsonDateTime
      -> ExternalProduct)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe [ExternalProductReferenceMini])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"external_product_references")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe JsonDateTime
   -> ExternalProduct)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PlanMini
      -> Maybe JsonDateTime
      -> ExternalProduct)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PlanMini
   -> Maybe JsonDateTime
   -> ExternalProduct)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PlanMini -> Maybe JsonDateTime -> ExternalProduct)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"name")) Parser
  (Maybe Text
   -> Maybe PlanMini -> Maybe JsonDateTime -> ExternalProduct)
-> Parser (Maybe Text)
-> Parser (Maybe PlanMini -> Maybe JsonDateTime -> ExternalProduct)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser (Maybe PlanMini -> Maybe JsonDateTime -> ExternalProduct)
-> Parser (Maybe PlanMini)
-> Parser (Maybe JsonDateTime -> ExternalProduct)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe PlanMini)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"plan")) Parser (Maybe JsonDateTime -> ExternalProduct)
-> Parser (Maybe JsonDateTime) -> Parser ExternalProduct
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at"))

-- | Create a new 'ExternalProduct' with all required fields.
mkExternalProduct :: ExternalProduct
mkExternalProduct :: ExternalProduct
mkExternalProduct =
    ExternalProduct
        { externalProductCreated_at :: Maybe JsonDateTime
externalProductCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , externalProductExternal_product_references :: Maybe [ExternalProductReferenceMini]
externalProductExternal_product_references = Maybe [ExternalProductReferenceMini]
forall a. Maybe a
GHC.Maybe.Nothing
        , externalProductId :: Maybe Text
externalProductId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalProductName :: Maybe Text
externalProductName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalProductObject :: Maybe Text
externalProductObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , externalProductPlan :: Maybe PlanMini
externalProductPlan = Maybe PlanMini
forall a. Maybe a
GHC.Maybe.Nothing
        , externalProductUpdated_at :: Maybe JsonDateTime
externalProductUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        }