{-# 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 AccountSepaDebitPaymentsSettings
module StripeAPI.Types.AccountSepaDebitPaymentsSettings 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.account_sepa_debit_payments_settings@ in the specification.
data AccountSepaDebitPaymentsSettings = AccountSepaDebitPaymentsSettings
  { -- | creditor_id: SEPA creditor identifier that identifies the company making the payment.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountSepaDebitPaymentsSettings -> Maybe Text
accountSepaDebitPaymentsSettingsCreditorId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> AccountSepaDebitPaymentsSettings -> ShowS
[AccountSepaDebitPaymentsSettings] -> ShowS
AccountSepaDebitPaymentsSettings -> String
(Int -> AccountSepaDebitPaymentsSettings -> ShowS)
-> (AccountSepaDebitPaymentsSettings -> String)
-> ([AccountSepaDebitPaymentsSettings] -> ShowS)
-> Show AccountSepaDebitPaymentsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountSepaDebitPaymentsSettings] -> ShowS
$cshowList :: [AccountSepaDebitPaymentsSettings] -> ShowS
show :: AccountSepaDebitPaymentsSettings -> String
$cshow :: AccountSepaDebitPaymentsSettings -> String
showsPrec :: Int -> AccountSepaDebitPaymentsSettings -> ShowS
$cshowsPrec :: Int -> AccountSepaDebitPaymentsSettings -> ShowS
GHC.Show.Show,
      AccountSepaDebitPaymentsSettings
-> AccountSepaDebitPaymentsSettings -> Bool
(AccountSepaDebitPaymentsSettings
 -> AccountSepaDebitPaymentsSettings -> Bool)
-> (AccountSepaDebitPaymentsSettings
    -> AccountSepaDebitPaymentsSettings -> Bool)
-> Eq AccountSepaDebitPaymentsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountSepaDebitPaymentsSettings
-> AccountSepaDebitPaymentsSettings -> Bool
$c/= :: AccountSepaDebitPaymentsSettings
-> AccountSepaDebitPaymentsSettings -> Bool
== :: AccountSepaDebitPaymentsSettings
-> AccountSepaDebitPaymentsSettings -> Bool
$c== :: AccountSepaDebitPaymentsSettings
-> AccountSepaDebitPaymentsSettings -> Bool
GHC.Classes.Eq
    )

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

instance Data.Aeson.Types.FromJSON.FromJSON AccountSepaDebitPaymentsSettings where
  parseJSON :: Value -> Parser AccountSepaDebitPaymentsSettings
parseJSON = String
-> (Object -> Parser AccountSepaDebitPaymentsSettings)
-> Value
-> Parser AccountSepaDebitPaymentsSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"AccountSepaDebitPaymentsSettings" (\Object
obj -> (Maybe Text -> AccountSepaDebitPaymentsSettings)
-> Parser (Maybe Text -> AccountSepaDebitPaymentsSettings)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text -> AccountSepaDebitPaymentsSettings
AccountSepaDebitPaymentsSettings Parser (Maybe Text -> AccountSepaDebitPaymentsSettings)
-> Parser (Maybe Text) -> Parser AccountSepaDebitPaymentsSettings
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
"creditor_id"))

-- | Create a new 'AccountSepaDebitPaymentsSettings' with all required fields.
mkAccountSepaDebitPaymentsSettings :: AccountSepaDebitPaymentsSettings
mkAccountSepaDebitPaymentsSettings :: AccountSepaDebitPaymentsSettings
mkAccountSepaDebitPaymentsSettings = AccountSepaDebitPaymentsSettings :: Maybe Text -> AccountSepaDebitPaymentsSettings
AccountSepaDebitPaymentsSettings {accountSepaDebitPaymentsSettingsCreditorId :: Maybe Text
accountSepaDebitPaymentsSettingsCreditorId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing}