{-# 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 PaymentMethodOptionsBancontact
module StripeAPI.Types.PaymentMethodOptionsBancontact 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.payment_method_options_bancontact@ in the specification.
data PaymentMethodOptionsBancontact = PaymentMethodOptionsBancontact
  { -- | preferred_language: Preferred language of the Bancontact authorization page that the customer is redirected to.
    PaymentMethodOptionsBancontact
-> PaymentMethodOptionsBancontactPreferredLanguage'
paymentMethodOptionsBancontactPreferredLanguage :: PaymentMethodOptionsBancontactPreferredLanguage'
  }
  deriving
    ( Int -> PaymentMethodOptionsBancontact -> ShowS
[PaymentMethodOptionsBancontact] -> ShowS
PaymentMethodOptionsBancontact -> String
(Int -> PaymentMethodOptionsBancontact -> ShowS)
-> (PaymentMethodOptionsBancontact -> String)
-> ([PaymentMethodOptionsBancontact] -> ShowS)
-> Show PaymentMethodOptionsBancontact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodOptionsBancontact] -> ShowS
$cshowList :: [PaymentMethodOptionsBancontact] -> ShowS
show :: PaymentMethodOptionsBancontact -> String
$cshow :: PaymentMethodOptionsBancontact -> String
showsPrec :: Int -> PaymentMethodOptionsBancontact -> ShowS
$cshowsPrec :: Int -> PaymentMethodOptionsBancontact -> ShowS
GHC.Show.Show,
      PaymentMethodOptionsBancontact
-> PaymentMethodOptionsBancontact -> Bool
(PaymentMethodOptionsBancontact
 -> PaymentMethodOptionsBancontact -> Bool)
-> (PaymentMethodOptionsBancontact
    -> PaymentMethodOptionsBancontact -> Bool)
-> Eq PaymentMethodOptionsBancontact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodOptionsBancontact
-> PaymentMethodOptionsBancontact -> Bool
$c/= :: PaymentMethodOptionsBancontact
-> PaymentMethodOptionsBancontact -> Bool
== :: PaymentMethodOptionsBancontact
-> PaymentMethodOptionsBancontact -> Bool
$c== :: PaymentMethodOptionsBancontact
-> PaymentMethodOptionsBancontact -> Bool
GHC.Classes.Eq
    )

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

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodOptionsBancontact where
  parseJSON :: Value -> Parser PaymentMethodOptionsBancontact
parseJSON = String
-> (Object -> Parser PaymentMethodOptionsBancontact)
-> Value
-> Parser PaymentMethodOptionsBancontact
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PaymentMethodOptionsBancontact" (\Object
obj -> (PaymentMethodOptionsBancontactPreferredLanguage'
 -> PaymentMethodOptionsBancontact)
-> Parser
     (PaymentMethodOptionsBancontactPreferredLanguage'
      -> PaymentMethodOptionsBancontact)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontact
PaymentMethodOptionsBancontact Parser
  (PaymentMethodOptionsBancontactPreferredLanguage'
   -> PaymentMethodOptionsBancontact)
-> Parser PaymentMethodOptionsBancontactPreferredLanguage'
-> Parser PaymentMethodOptionsBancontact
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser PaymentMethodOptionsBancontactPreferredLanguage'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"preferred_language"))

-- | Create a new 'PaymentMethodOptionsBancontact' with all required fields.
mkPaymentMethodOptionsBancontact ::
  -- | 'paymentMethodOptionsBancontactPreferredLanguage'
  PaymentMethodOptionsBancontactPreferredLanguage' ->
  PaymentMethodOptionsBancontact
mkPaymentMethodOptionsBancontact :: PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontact
mkPaymentMethodOptionsBancontact PaymentMethodOptionsBancontactPreferredLanguage'
paymentMethodOptionsBancontactPreferredLanguage = PaymentMethodOptionsBancontact :: PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontact
PaymentMethodOptionsBancontact {paymentMethodOptionsBancontactPreferredLanguage :: PaymentMethodOptionsBancontactPreferredLanguage'
paymentMethodOptionsBancontactPreferredLanguage = PaymentMethodOptionsBancontactPreferredLanguage'
paymentMethodOptionsBancontactPreferredLanguage}

-- | Defines the enum schema located at @components.schemas.payment_method_options_bancontact.properties.preferred_language@ in the specification.
--
-- Preferred language of the Bancontact authorization page that the customer is redirected to.
data PaymentMethodOptionsBancontactPreferredLanguage'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    PaymentMethodOptionsBancontactPreferredLanguage'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    PaymentMethodOptionsBancontactPreferredLanguage'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"de"@
    PaymentMethodOptionsBancontactPreferredLanguage'EnumDe
  | -- | Represents the JSON value @"en"@
    PaymentMethodOptionsBancontactPreferredLanguage'EnumEn
  | -- | Represents the JSON value @"fr"@
    PaymentMethodOptionsBancontactPreferredLanguage'EnumFr
  | -- | Represents the JSON value @"nl"@
    PaymentMethodOptionsBancontactPreferredLanguage'EnumNl
  deriving (Int -> PaymentMethodOptionsBancontactPreferredLanguage' -> ShowS
[PaymentMethodOptionsBancontactPreferredLanguage'] -> ShowS
PaymentMethodOptionsBancontactPreferredLanguage' -> String
(Int -> PaymentMethodOptionsBancontactPreferredLanguage' -> ShowS)
-> (PaymentMethodOptionsBancontactPreferredLanguage' -> String)
-> ([PaymentMethodOptionsBancontactPreferredLanguage'] -> ShowS)
-> Show PaymentMethodOptionsBancontactPreferredLanguage'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentMethodOptionsBancontactPreferredLanguage'] -> ShowS
$cshowList :: [PaymentMethodOptionsBancontactPreferredLanguage'] -> ShowS
show :: PaymentMethodOptionsBancontactPreferredLanguage' -> String
$cshow :: PaymentMethodOptionsBancontactPreferredLanguage' -> String
showsPrec :: Int -> PaymentMethodOptionsBancontactPreferredLanguage' -> ShowS
$cshowsPrec :: Int -> PaymentMethodOptionsBancontactPreferredLanguage' -> ShowS
GHC.Show.Show, PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool
(PaymentMethodOptionsBancontactPreferredLanguage'
 -> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool)
-> (PaymentMethodOptionsBancontactPreferredLanguage'
    -> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool)
-> Eq PaymentMethodOptionsBancontactPreferredLanguage'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool
$c/= :: PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool
== :: PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool
$c== :: PaymentMethodOptionsBancontactPreferredLanguage'
-> PaymentMethodOptionsBancontactPreferredLanguage' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON PaymentMethodOptionsBancontactPreferredLanguage' where
  toJSON :: PaymentMethodOptionsBancontactPreferredLanguage' -> Value
toJSON (PaymentMethodOptionsBancontactPreferredLanguage'Other Value
val) = Value
val
  toJSON (PaymentMethodOptionsBancontactPreferredLanguage'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumDe) = Value
"de"
  toJSON (PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumEn) = Value
"en"
  toJSON (PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumFr) = Value
"fr"
  toJSON (PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumNl) = Value
"nl"

instance Data.Aeson.Types.FromJSON.FromJSON PaymentMethodOptionsBancontactPreferredLanguage' where
  parseJSON :: Value -> Parser PaymentMethodOptionsBancontactPreferredLanguage'
parseJSON Value
val =
    PaymentMethodOptionsBancontactPreferredLanguage'
-> Parser PaymentMethodOptionsBancontactPreferredLanguage'
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
      ( if
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"de" -> PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumDe
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"en" -> PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumEn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"fr" -> PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumFr
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"nl" -> PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'EnumNl
            | Bool
GHC.Base.otherwise -> Value -> PaymentMethodOptionsBancontactPreferredLanguage'
PaymentMethodOptionsBancontactPreferredLanguage'Other Value
val
      )