{-# 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 AccountBacsDebitPaymentsSettings
module StripeAPI.Types.AccountBacsDebitPaymentsSettings 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_bacs_debit_payments_settings@ in the specification.
data AccountBacsDebitPaymentsSettings = AccountBacsDebitPaymentsSettings
  { -- | display_name: The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this will appear on the mandate, and as the statement descriptor.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountBacsDebitPaymentsSettings -> Maybe Text
accountBacsDebitPaymentsSettingsDisplayName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> AccountBacsDebitPaymentsSettings -> ShowS
[AccountBacsDebitPaymentsSettings] -> ShowS
AccountBacsDebitPaymentsSettings -> String
(Int -> AccountBacsDebitPaymentsSettings -> ShowS)
-> (AccountBacsDebitPaymentsSettings -> String)
-> ([AccountBacsDebitPaymentsSettings] -> ShowS)
-> Show AccountBacsDebitPaymentsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountBacsDebitPaymentsSettings] -> ShowS
$cshowList :: [AccountBacsDebitPaymentsSettings] -> ShowS
show :: AccountBacsDebitPaymentsSettings -> String
$cshow :: AccountBacsDebitPaymentsSettings -> String
showsPrec :: Int -> AccountBacsDebitPaymentsSettings -> ShowS
$cshowsPrec :: Int -> AccountBacsDebitPaymentsSettings -> ShowS
GHC.Show.Show,
      AccountBacsDebitPaymentsSettings
-> AccountBacsDebitPaymentsSettings -> Bool
(AccountBacsDebitPaymentsSettings
 -> AccountBacsDebitPaymentsSettings -> Bool)
-> (AccountBacsDebitPaymentsSettings
    -> AccountBacsDebitPaymentsSettings -> Bool)
-> Eq AccountBacsDebitPaymentsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountBacsDebitPaymentsSettings
-> AccountBacsDebitPaymentsSettings -> Bool
$c/= :: AccountBacsDebitPaymentsSettings
-> AccountBacsDebitPaymentsSettings -> Bool
== :: AccountBacsDebitPaymentsSettings
-> AccountBacsDebitPaymentsSettings -> Bool
$c== :: AccountBacsDebitPaymentsSettings
-> AccountBacsDebitPaymentsSettings -> Bool
GHC.Classes.Eq
    )

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

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

-- | Create a new 'AccountBacsDebitPaymentsSettings' with all required fields.
mkAccountBacsDebitPaymentsSettings :: AccountBacsDebitPaymentsSettings
mkAccountBacsDebitPaymentsSettings :: AccountBacsDebitPaymentsSettings
mkAccountBacsDebitPaymentsSettings = AccountBacsDebitPaymentsSettings :: Maybe Text -> AccountBacsDebitPaymentsSettings
AccountBacsDebitPaymentsSettings {accountBacsDebitPaymentsSettingsDisplayName :: Maybe Text
accountBacsDebitPaymentsSettingsDisplayName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing}