{-# 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 AccountPaymentsSettings
module StripeAPI.Types.AccountPaymentsSettings 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_payments_settings@ in the specification.
data AccountPaymentsSettings = AccountPaymentsSettings
  { -- | statement_descriptor: The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic \`statement_descriptor\` specified on the charge.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptor :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | statement_descriptor_kana: The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only)
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptorKana :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | statement_descriptor_kanji: The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only)
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptorKanji :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> AccountPaymentsSettings -> ShowS
[AccountPaymentsSettings] -> ShowS
AccountPaymentsSettings -> String
(Int -> AccountPaymentsSettings -> ShowS)
-> (AccountPaymentsSettings -> String)
-> ([AccountPaymentsSettings] -> ShowS)
-> Show AccountPaymentsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountPaymentsSettings] -> ShowS
$cshowList :: [AccountPaymentsSettings] -> ShowS
show :: AccountPaymentsSettings -> String
$cshow :: AccountPaymentsSettings -> String
showsPrec :: Int -> AccountPaymentsSettings -> ShowS
$cshowsPrec :: Int -> AccountPaymentsSettings -> ShowS
GHC.Show.Show,
      AccountPaymentsSettings -> AccountPaymentsSettings -> Bool
(AccountPaymentsSettings -> AccountPaymentsSettings -> Bool)
-> (AccountPaymentsSettings -> AccountPaymentsSettings -> Bool)
-> Eq AccountPaymentsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountPaymentsSettings -> AccountPaymentsSettings -> Bool
$c/= :: AccountPaymentsSettings -> AccountPaymentsSettings -> Bool
== :: AccountPaymentsSettings -> AccountPaymentsSettings -> Bool
$c== :: AccountPaymentsSettings -> AccountPaymentsSettings -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON AccountPaymentsSettings where
  toJSON :: AccountPaymentsSettings -> Value
toJSON AccountPaymentsSettings
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"statement_descriptor" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptor AccountPaymentsSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor_kana" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptorKana AccountPaymentsSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"statement_descriptor_kanji" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptorKanji AccountPaymentsSettings
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: AccountPaymentsSettings -> Encoding
toEncoding AccountPaymentsSettings
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"statement_descriptor" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptor AccountPaymentsSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"statement_descriptor_kana" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptorKana AccountPaymentsSettings
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"statement_descriptor_kanji" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= AccountPaymentsSettings -> Maybe Text
accountPaymentsSettingsStatementDescriptorKanji AccountPaymentsSettings
obj)))

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

-- | Create a new 'AccountPaymentsSettings' with all required fields.
mkAccountPaymentsSettings :: AccountPaymentsSettings
mkAccountPaymentsSettings :: AccountPaymentsSettings
mkAccountPaymentsSettings =
  AccountPaymentsSettings :: Maybe Text -> Maybe Text -> Maybe Text -> AccountPaymentsSettings
AccountPaymentsSettings
    { accountPaymentsSettingsStatementDescriptor :: Maybe Text
accountPaymentsSettingsStatementDescriptor = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      accountPaymentsSettingsStatementDescriptorKana :: Maybe Text
accountPaymentsSettingsStatementDescriptorKana = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      accountPaymentsSettingsStatementDescriptorKanji :: Maybe Text
accountPaymentsSettingsStatementDescriptorKanji = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }