{-# 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 SetupIntentNextActionVerifyWithMicrodeposits
module StripeAPI.Types.SetupIntentNextActionVerifyWithMicrodeposits 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_next_action_verify_with_microdeposits@ in the specification.
data SetupIntentNextActionVerifyWithMicrodeposits = SetupIntentNextActionVerifyWithMicrodeposits
  { -- | arrival_date: The timestamp when the microdeposits are expected to land.
    SetupIntentNextActionVerifyWithMicrodeposits -> Int
setupIntentNextActionVerifyWithMicrodepositsArrivalDate :: GHC.Types.Int,
    -- | hosted_verification_url: The URL for the hosted verification page, which allows customers to verify their bank account.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    SetupIntentNextActionVerifyWithMicrodeposits -> Text
setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> SetupIntentNextActionVerifyWithMicrodeposits -> ShowS
[SetupIntentNextActionVerifyWithMicrodeposits] -> ShowS
SetupIntentNextActionVerifyWithMicrodeposits -> String
(Int -> SetupIntentNextActionVerifyWithMicrodeposits -> ShowS)
-> (SetupIntentNextActionVerifyWithMicrodeposits -> String)
-> ([SetupIntentNextActionVerifyWithMicrodeposits] -> ShowS)
-> Show SetupIntentNextActionVerifyWithMicrodeposits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetupIntentNextActionVerifyWithMicrodeposits] -> ShowS
$cshowList :: [SetupIntentNextActionVerifyWithMicrodeposits] -> ShowS
show :: SetupIntentNextActionVerifyWithMicrodeposits -> String
$cshow :: SetupIntentNextActionVerifyWithMicrodeposits -> String
showsPrec :: Int -> SetupIntentNextActionVerifyWithMicrodeposits -> ShowS
$cshowsPrec :: Int -> SetupIntentNextActionVerifyWithMicrodeposits -> ShowS
GHC.Show.Show,
      SetupIntentNextActionVerifyWithMicrodeposits
-> SetupIntentNextActionVerifyWithMicrodeposits -> Bool
(SetupIntentNextActionVerifyWithMicrodeposits
 -> SetupIntentNextActionVerifyWithMicrodeposits -> Bool)
-> (SetupIntentNextActionVerifyWithMicrodeposits
    -> SetupIntentNextActionVerifyWithMicrodeposits -> Bool)
-> Eq SetupIntentNextActionVerifyWithMicrodeposits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetupIntentNextActionVerifyWithMicrodeposits
-> SetupIntentNextActionVerifyWithMicrodeposits -> Bool
$c/= :: SetupIntentNextActionVerifyWithMicrodeposits
-> SetupIntentNextActionVerifyWithMicrodeposits -> Bool
== :: SetupIntentNextActionVerifyWithMicrodeposits
-> SetupIntentNextActionVerifyWithMicrodeposits -> Bool
$c== :: SetupIntentNextActionVerifyWithMicrodeposits
-> SetupIntentNextActionVerifyWithMicrodeposits -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON SetupIntentNextActionVerifyWithMicrodeposits where
  toJSON :: SetupIntentNextActionVerifyWithMicrodeposits -> Value
toJSON SetupIntentNextActionVerifyWithMicrodeposits
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"arrival_date" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentNextActionVerifyWithMicrodeposits -> Int
setupIntentNextActionVerifyWithMicrodepositsArrivalDate SetupIntentNextActionVerifyWithMicrodeposits
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"hosted_verification_url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentNextActionVerifyWithMicrodeposits -> Text
setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl SetupIntentNextActionVerifyWithMicrodeposits
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: SetupIntentNextActionVerifyWithMicrodeposits -> Encoding
toEncoding SetupIntentNextActionVerifyWithMicrodeposits
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"arrival_date" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentNextActionVerifyWithMicrodeposits -> Int
setupIntentNextActionVerifyWithMicrodepositsArrivalDate SetupIntentNextActionVerifyWithMicrodeposits
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"hosted_verification_url" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= SetupIntentNextActionVerifyWithMicrodeposits -> Text
setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl SetupIntentNextActionVerifyWithMicrodeposits
obj))

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

-- | Create a new 'SetupIntentNextActionVerifyWithMicrodeposits' with all required fields.
mkSetupIntentNextActionVerifyWithMicrodeposits ::
  -- | 'setupIntentNextActionVerifyWithMicrodepositsArrivalDate'
  GHC.Types.Int ->
  -- | 'setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl'
  Data.Text.Internal.Text ->
  SetupIntentNextActionVerifyWithMicrodeposits
mkSetupIntentNextActionVerifyWithMicrodeposits :: Int -> Text -> SetupIntentNextActionVerifyWithMicrodeposits
mkSetupIntentNextActionVerifyWithMicrodeposits Int
setupIntentNextActionVerifyWithMicrodepositsArrivalDate Text
setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl =
  SetupIntentNextActionVerifyWithMicrodeposits :: Int -> Text -> SetupIntentNextActionVerifyWithMicrodeposits
SetupIntentNextActionVerifyWithMicrodeposits
    { setupIntentNextActionVerifyWithMicrodepositsArrivalDate :: Int
setupIntentNextActionVerifyWithMicrodepositsArrivalDate = Int
setupIntentNextActionVerifyWithMicrodepositsArrivalDate,
      setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl :: Text
setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl = Text
setupIntentNextActionVerifyWithMicrodepositsHostedVerificationUrl
    }