{-# 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 PaymentIntentNextActionDisplayOxxoDetails
module StripeAPI.Types.PaymentIntentNextActionDisplayOxxoDetails 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_intent_next_action_display_oxxo_details@ in the specification.
data PaymentIntentNextActionDisplayOxxoDetails = PaymentIntentNextActionDisplayOxxoDetails
  { -- | expires_after: The timestamp after which the OXXO voucher expires.
    PaymentIntentNextActionDisplayOxxoDetails -> Maybe Int
paymentIntentNextActionDisplayOxxoDetailsExpiresAfter :: (GHC.Maybe.Maybe GHC.Types.Int),
    -- | hosted_voucher_url: The URL for the hosted OXXO voucher page, which allows customers to view and print an OXXO voucher.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentIntentNextActionDisplayOxxoDetails -> Maybe Text
paymentIntentNextActionDisplayOxxoDetailsHostedVoucherUrl :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | number: OXXO reference number.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    PaymentIntentNextActionDisplayOxxoDetails -> Maybe Text
paymentIntentNextActionDisplayOxxoDetailsNumber :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> PaymentIntentNextActionDisplayOxxoDetails -> ShowS
[PaymentIntentNextActionDisplayOxxoDetails] -> ShowS
PaymentIntentNextActionDisplayOxxoDetails -> String
(Int -> PaymentIntentNextActionDisplayOxxoDetails -> ShowS)
-> (PaymentIntentNextActionDisplayOxxoDetails -> String)
-> ([PaymentIntentNextActionDisplayOxxoDetails] -> ShowS)
-> Show PaymentIntentNextActionDisplayOxxoDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PaymentIntentNextActionDisplayOxxoDetails] -> ShowS
$cshowList :: [PaymentIntentNextActionDisplayOxxoDetails] -> ShowS
show :: PaymentIntentNextActionDisplayOxxoDetails -> String
$cshow :: PaymentIntentNextActionDisplayOxxoDetails -> String
showsPrec :: Int -> PaymentIntentNextActionDisplayOxxoDetails -> ShowS
$cshowsPrec :: Int -> PaymentIntentNextActionDisplayOxxoDetails -> ShowS
GHC.Show.Show,
      PaymentIntentNextActionDisplayOxxoDetails
-> PaymentIntentNextActionDisplayOxxoDetails -> Bool
(PaymentIntentNextActionDisplayOxxoDetails
 -> PaymentIntentNextActionDisplayOxxoDetails -> Bool)
-> (PaymentIntentNextActionDisplayOxxoDetails
    -> PaymentIntentNextActionDisplayOxxoDetails -> Bool)
-> Eq PaymentIntentNextActionDisplayOxxoDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PaymentIntentNextActionDisplayOxxoDetails
-> PaymentIntentNextActionDisplayOxxoDetails -> Bool
$c/= :: PaymentIntentNextActionDisplayOxxoDetails
-> PaymentIntentNextActionDisplayOxxoDetails -> Bool
== :: PaymentIntentNextActionDisplayOxxoDetails
-> PaymentIntentNextActionDisplayOxxoDetails -> Bool
$c== :: PaymentIntentNextActionDisplayOxxoDetails
-> PaymentIntentNextActionDisplayOxxoDetails -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PaymentIntentNextActionDisplayOxxoDetails where
  toJSON :: PaymentIntentNextActionDisplayOxxoDetails -> Value
toJSON PaymentIntentNextActionDisplayOxxoDetails
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"expires_after" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionDisplayOxxoDetails -> Maybe Int
paymentIntentNextActionDisplayOxxoDetailsExpiresAfter PaymentIntentNextActionDisplayOxxoDetails
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"hosted_voucher_url" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionDisplayOxxoDetails -> Maybe Text
paymentIntentNextActionDisplayOxxoDetailsHostedVoucherUrl PaymentIntentNextActionDisplayOxxoDetails
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"number" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionDisplayOxxoDetails -> Maybe Text
paymentIntentNextActionDisplayOxxoDetailsNumber PaymentIntentNextActionDisplayOxxoDetails
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PaymentIntentNextActionDisplayOxxoDetails -> Encoding
toEncoding PaymentIntentNextActionDisplayOxxoDetails
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"expires_after" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionDisplayOxxoDetails -> Maybe Int
paymentIntentNextActionDisplayOxxoDetailsExpiresAfter PaymentIntentNextActionDisplayOxxoDetails
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"hosted_voucher_url" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionDisplayOxxoDetails -> Maybe Text
paymentIntentNextActionDisplayOxxoDetailsHostedVoucherUrl PaymentIntentNextActionDisplayOxxoDetails
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"number" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PaymentIntentNextActionDisplayOxxoDetails -> Maybe Text
paymentIntentNextActionDisplayOxxoDetailsNumber PaymentIntentNextActionDisplayOxxoDetails
obj)))

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

-- | Create a new 'PaymentIntentNextActionDisplayOxxoDetails' with all required fields.
mkPaymentIntentNextActionDisplayOxxoDetails :: PaymentIntentNextActionDisplayOxxoDetails
mkPaymentIntentNextActionDisplayOxxoDetails :: PaymentIntentNextActionDisplayOxxoDetails
mkPaymentIntentNextActionDisplayOxxoDetails =
  PaymentIntentNextActionDisplayOxxoDetails :: Maybe Int
-> Maybe Text
-> Maybe Text
-> PaymentIntentNextActionDisplayOxxoDetails
PaymentIntentNextActionDisplayOxxoDetails
    { paymentIntentNextActionDisplayOxxoDetailsExpiresAfter :: Maybe Int
paymentIntentNextActionDisplayOxxoDetailsExpiresAfter = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentIntentNextActionDisplayOxxoDetailsHostedVoucherUrl :: Maybe Text
paymentIntentNextActionDisplayOxxoDetailsHostedVoucherUrl = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      paymentIntentNextActionDisplayOxxoDetailsNumber :: Maybe Text
paymentIntentNextActionDisplayOxxoDetailsNumber = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }