{-# 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 SetupIntentPaymentMethodOptionsSepaDebit
module StripeAPI.Types.SetupIntentPaymentMethodOptionsSepaDebit 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 qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.setup_intent_payment_method_options_sepa_debit@ in the specification.
data SetupIntentPaymentMethodOptionsSepaDebit = SetupIntentPaymentMethodOptionsSepaDebit
  { -- | mandate_options:
    SetupIntentPaymentMethodOptionsSepaDebit
-> Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
setupIntentPaymentMethodOptionsSepaDebitMandateOptions :: (GHC.Maybe.Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit)
  }
  deriving
    ( Int -> SetupIntentPaymentMethodOptionsSepaDebit -> ShowS
[SetupIntentPaymentMethodOptionsSepaDebit] -> ShowS
SetupIntentPaymentMethodOptionsSepaDebit -> String
(Int -> SetupIntentPaymentMethodOptionsSepaDebit -> ShowS)
-> (SetupIntentPaymentMethodOptionsSepaDebit -> String)
-> ([SetupIntentPaymentMethodOptionsSepaDebit] -> ShowS)
-> Show SetupIntentPaymentMethodOptionsSepaDebit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetupIntentPaymentMethodOptionsSepaDebit] -> ShowS
$cshowList :: [SetupIntentPaymentMethodOptionsSepaDebit] -> ShowS
show :: SetupIntentPaymentMethodOptionsSepaDebit -> String
$cshow :: SetupIntentPaymentMethodOptionsSepaDebit -> String
showsPrec :: Int -> SetupIntentPaymentMethodOptionsSepaDebit -> ShowS
$cshowsPrec :: Int -> SetupIntentPaymentMethodOptionsSepaDebit -> ShowS
GHC.Show.Show,
      SetupIntentPaymentMethodOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit -> Bool
(SetupIntentPaymentMethodOptionsSepaDebit
 -> SetupIntentPaymentMethodOptionsSepaDebit -> Bool)
-> (SetupIntentPaymentMethodOptionsSepaDebit
    -> SetupIntentPaymentMethodOptionsSepaDebit -> Bool)
-> Eq SetupIntentPaymentMethodOptionsSepaDebit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetupIntentPaymentMethodOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit -> Bool
$c/= :: SetupIntentPaymentMethodOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit -> Bool
== :: SetupIntentPaymentMethodOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit -> Bool
$c== :: SetupIntentPaymentMethodOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON SetupIntentPaymentMethodOptionsSepaDebit where
  toJSON :: SetupIntentPaymentMethodOptionsSepaDebit -> Value
toJSON SetupIntentPaymentMethodOptionsSepaDebit
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"mandate_options" Text
-> Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentPaymentMethodOptionsSepaDebit
-> Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
setupIntentPaymentMethodOptionsSepaDebitMandateOptions SetupIntentPaymentMethodOptionsSepaDebit
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: SetupIntentPaymentMethodOptionsSepaDebit -> Encoding
toEncoding SetupIntentPaymentMethodOptionsSepaDebit
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"mandate_options" Text
-> Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentPaymentMethodOptionsSepaDebit
-> Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
setupIntentPaymentMethodOptionsSepaDebitMandateOptions SetupIntentPaymentMethodOptionsSepaDebit
obj)

instance Data.Aeson.Types.FromJSON.FromJSON SetupIntentPaymentMethodOptionsSepaDebit where
  parseJSON :: Value -> Parser SetupIntentPaymentMethodOptionsSepaDebit
parseJSON = String
-> (SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
    -> Parser SetupIntentPaymentMethodOptionsSepaDebit)
-> Value
-> Parser SetupIntentPaymentMethodOptionsSepaDebit
forall a.
String
-> (SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
    -> Parser a)
-> Value
-> Parser a
Data.Aeson.Types.FromJSON.withObject String
"SetupIntentPaymentMethodOptionsSepaDebit" (\SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
obj -> (Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
 -> SetupIntentPaymentMethodOptionsSepaDebit)
-> Parser
     (Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
      -> SetupIntentPaymentMethodOptionsSepaDebit)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit
SetupIntentPaymentMethodOptionsSepaDebit Parser
  (Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
   -> SetupIntentPaymentMethodOptionsSepaDebit)
-> Parser
     (Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit)
-> Parser SetupIntentPaymentMethodOptionsSepaDebit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
obj SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
-> Text
-> Parser
     (Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit)
forall a.
FromJSON a =>
SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
-> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"mandate_options"))

-- | Create a new 'SetupIntentPaymentMethodOptionsSepaDebit' with all required fields.
mkSetupIntentPaymentMethodOptionsSepaDebit :: SetupIntentPaymentMethodOptionsSepaDebit
mkSetupIntentPaymentMethodOptionsSepaDebit :: SetupIntentPaymentMethodOptionsSepaDebit
mkSetupIntentPaymentMethodOptionsSepaDebit = SetupIntentPaymentMethodOptionsSepaDebit :: Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
-> SetupIntentPaymentMethodOptionsSepaDebit
SetupIntentPaymentMethodOptionsSepaDebit {setupIntentPaymentMethodOptionsSepaDebitMandateOptions :: Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
setupIntentPaymentMethodOptionsSepaDebitMandateOptions = Maybe SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit
forall a. Maybe a
GHC.Maybe.Nothing}