{-# 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 GelatoReportDocumentOptions
module StripeAPI.Types.GelatoReportDocumentOptions 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.gelato_report_document_options@ in the specification.
data GelatoReportDocumentOptions = GelatoReportDocumentOptions
  { -- | allowed_types: Array of strings of allowed identity document types. If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
    GelatoReportDocumentOptions
-> Maybe [GelatoReportDocumentOptionsAllowedTypes']
gelatoReportDocumentOptionsAllowedTypes :: (GHC.Maybe.Maybe ([GelatoReportDocumentOptionsAllowedTypes'])),
    -- | require_id_number: Collect an ID number and perform an [ID number check](https:\/\/stripe.com\/docs\/identity\/verification-checks?type=id-number) with the document’s extracted name and date of birth.
    GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireIdNumber :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | require_live_capture: Disable image uploads, identity document images have to be captured using the device’s camera.
    GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireLiveCapture :: (GHC.Maybe.Maybe GHC.Types.Bool),
    -- | require_matching_selfie: Capture a face image and perform a [selfie check](https:\/\/stripe.com\/docs\/identity\/verification-checks?type=selfie) comparing a photo ID and a picture of your user’s face. [Learn more](https:\/\/stripe.com\/docs\/identity\/selfie).
    GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireMatchingSelfie :: (GHC.Maybe.Maybe GHC.Types.Bool)
  }
  deriving
    ( Int -> GelatoReportDocumentOptions -> ShowS
[GelatoReportDocumentOptions] -> ShowS
GelatoReportDocumentOptions -> String
(Int -> GelatoReportDocumentOptions -> ShowS)
-> (GelatoReportDocumentOptions -> String)
-> ([GelatoReportDocumentOptions] -> ShowS)
-> Show GelatoReportDocumentOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GelatoReportDocumentOptions] -> ShowS
$cshowList :: [GelatoReportDocumentOptions] -> ShowS
show :: GelatoReportDocumentOptions -> String
$cshow :: GelatoReportDocumentOptions -> String
showsPrec :: Int -> GelatoReportDocumentOptions -> ShowS
$cshowsPrec :: Int -> GelatoReportDocumentOptions -> ShowS
GHC.Show.Show,
      GelatoReportDocumentOptions -> GelatoReportDocumentOptions -> Bool
(GelatoReportDocumentOptions
 -> GelatoReportDocumentOptions -> Bool)
-> (GelatoReportDocumentOptions
    -> GelatoReportDocumentOptions -> Bool)
-> Eq GelatoReportDocumentOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GelatoReportDocumentOptions -> GelatoReportDocumentOptions -> Bool
$c/= :: GelatoReportDocumentOptions -> GelatoReportDocumentOptions -> Bool
== :: GelatoReportDocumentOptions -> GelatoReportDocumentOptions -> Bool
$c== :: GelatoReportDocumentOptions -> GelatoReportDocumentOptions -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON GelatoReportDocumentOptions where
  toJSON :: GelatoReportDocumentOptions -> Value
toJSON GelatoReportDocumentOptions
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"allowed_types" Text -> Maybe [GelatoReportDocumentOptionsAllowedTypes'] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions
-> Maybe [GelatoReportDocumentOptionsAllowedTypes']
gelatoReportDocumentOptionsAllowedTypes GelatoReportDocumentOptions
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"require_id_number" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireIdNumber GelatoReportDocumentOptions
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"require_live_capture" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireLiveCapture GelatoReportDocumentOptions
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"require_matching_selfie" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireMatchingSelfie GelatoReportDocumentOptions
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: GelatoReportDocumentOptions -> Encoding
toEncoding GelatoReportDocumentOptions
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"allowed_types" Text -> Maybe [GelatoReportDocumentOptionsAllowedTypes'] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions
-> Maybe [GelatoReportDocumentOptionsAllowedTypes']
gelatoReportDocumentOptionsAllowedTypes GelatoReportDocumentOptions
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"require_id_number" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireIdNumber GelatoReportDocumentOptions
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"require_live_capture" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireLiveCapture GelatoReportDocumentOptions
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"require_matching_selfie" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= GelatoReportDocumentOptions -> Maybe Bool
gelatoReportDocumentOptionsRequireMatchingSelfie GelatoReportDocumentOptions
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON GelatoReportDocumentOptions where
  parseJSON :: Value -> Parser GelatoReportDocumentOptions
parseJSON = String
-> (Object -> Parser GelatoReportDocumentOptions)
-> Value
-> Parser GelatoReportDocumentOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"GelatoReportDocumentOptions" (\Object
obj -> ((((Maybe [GelatoReportDocumentOptionsAllowedTypes']
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> GelatoReportDocumentOptions)
-> Parser
     (Maybe [GelatoReportDocumentOptionsAllowedTypes']
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> GelatoReportDocumentOptions)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe [GelatoReportDocumentOptionsAllowedTypes']
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> GelatoReportDocumentOptions
GelatoReportDocumentOptions Parser
  (Maybe [GelatoReportDocumentOptionsAllowedTypes']
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> GelatoReportDocumentOptions)
-> Parser (Maybe [GelatoReportDocumentOptionsAllowedTypes'])
-> Parser
     (Maybe Bool
      -> Maybe Bool -> Maybe Bool -> GelatoReportDocumentOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser (Maybe [GelatoReportDocumentOptionsAllowedTypes'])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"allowed_types")) Parser
  (Maybe Bool
   -> Maybe Bool -> Maybe Bool -> GelatoReportDocumentOptions)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Maybe Bool -> GelatoReportDocumentOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"require_id_number")) Parser (Maybe Bool -> Maybe Bool -> GelatoReportDocumentOptions)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> GelatoReportDocumentOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"require_live_capture")) Parser (Maybe Bool -> GelatoReportDocumentOptions)
-> Parser (Maybe Bool) -> Parser GelatoReportDocumentOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"require_matching_selfie"))

-- | Create a new 'GelatoReportDocumentOptions' with all required fields.
mkGelatoReportDocumentOptions :: GelatoReportDocumentOptions
mkGelatoReportDocumentOptions :: GelatoReportDocumentOptions
mkGelatoReportDocumentOptions =
  GelatoReportDocumentOptions :: Maybe [GelatoReportDocumentOptionsAllowedTypes']
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> GelatoReportDocumentOptions
GelatoReportDocumentOptions
    { gelatoReportDocumentOptionsAllowedTypes :: Maybe [GelatoReportDocumentOptionsAllowedTypes']
gelatoReportDocumentOptionsAllowedTypes = Maybe [GelatoReportDocumentOptionsAllowedTypes']
forall a. Maybe a
GHC.Maybe.Nothing,
      gelatoReportDocumentOptionsRequireIdNumber :: Maybe Bool
gelatoReportDocumentOptionsRequireIdNumber = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      gelatoReportDocumentOptionsRequireLiveCapture :: Maybe Bool
gelatoReportDocumentOptionsRequireLiveCapture = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
      gelatoReportDocumentOptionsRequireMatchingSelfie :: Maybe Bool
gelatoReportDocumentOptionsRequireMatchingSelfie = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.gelato_report_document_options.properties.allowed_types.items@ in the specification.
data GelatoReportDocumentOptionsAllowedTypes'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    GelatoReportDocumentOptionsAllowedTypes'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.
    GelatoReportDocumentOptionsAllowedTypes'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"driving_license"@
    GelatoReportDocumentOptionsAllowedTypes'EnumDrivingLicense
  | -- | Represents the JSON value @"id_card"@
    GelatoReportDocumentOptionsAllowedTypes'EnumIdCard
  | -- | Represents the JSON value @"passport"@
    GelatoReportDocumentOptionsAllowedTypes'EnumPassport
  deriving (Int -> GelatoReportDocumentOptionsAllowedTypes' -> ShowS
[GelatoReportDocumentOptionsAllowedTypes'] -> ShowS
GelatoReportDocumentOptionsAllowedTypes' -> String
(Int -> GelatoReportDocumentOptionsAllowedTypes' -> ShowS)
-> (GelatoReportDocumentOptionsAllowedTypes' -> String)
-> ([GelatoReportDocumentOptionsAllowedTypes'] -> ShowS)
-> Show GelatoReportDocumentOptionsAllowedTypes'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GelatoReportDocumentOptionsAllowedTypes'] -> ShowS
$cshowList :: [GelatoReportDocumentOptionsAllowedTypes'] -> ShowS
show :: GelatoReportDocumentOptionsAllowedTypes' -> String
$cshow :: GelatoReportDocumentOptionsAllowedTypes' -> String
showsPrec :: Int -> GelatoReportDocumentOptionsAllowedTypes' -> ShowS
$cshowsPrec :: Int -> GelatoReportDocumentOptionsAllowedTypes' -> ShowS
GHC.Show.Show, GelatoReportDocumentOptionsAllowedTypes'
-> GelatoReportDocumentOptionsAllowedTypes' -> Bool
(GelatoReportDocumentOptionsAllowedTypes'
 -> GelatoReportDocumentOptionsAllowedTypes' -> Bool)
-> (GelatoReportDocumentOptionsAllowedTypes'
    -> GelatoReportDocumentOptionsAllowedTypes' -> Bool)
-> Eq GelatoReportDocumentOptionsAllowedTypes'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GelatoReportDocumentOptionsAllowedTypes'
-> GelatoReportDocumentOptionsAllowedTypes' -> Bool
$c/= :: GelatoReportDocumentOptionsAllowedTypes'
-> GelatoReportDocumentOptionsAllowedTypes' -> Bool
== :: GelatoReportDocumentOptionsAllowedTypes'
-> GelatoReportDocumentOptionsAllowedTypes' -> Bool
$c== :: GelatoReportDocumentOptionsAllowedTypes'
-> GelatoReportDocumentOptionsAllowedTypes' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON GelatoReportDocumentOptionsAllowedTypes' where
  toJSON :: GelatoReportDocumentOptionsAllowedTypes' -> Value
toJSON (GelatoReportDocumentOptionsAllowedTypes'Other Value
val) = Value
val
  toJSON (GelatoReportDocumentOptionsAllowedTypes'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'EnumDrivingLicense) = Value
"driving_license"
  toJSON (GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'EnumIdCard) = Value
"id_card"
  toJSON (GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'EnumPassport) = Value
"passport"

instance Data.Aeson.Types.FromJSON.FromJSON GelatoReportDocumentOptionsAllowedTypes' where
  parseJSON :: Value -> Parser GelatoReportDocumentOptionsAllowedTypes'
parseJSON Value
val =
    GelatoReportDocumentOptionsAllowedTypes'
-> Parser GelatoReportDocumentOptionsAllowedTypes'
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
"driving_license" -> GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'EnumDrivingLicense
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"id_card" -> GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'EnumIdCard
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"passport" -> GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'EnumPassport
            | Bool
GHC.Base.otherwise -> Value -> GelatoReportDocumentOptionsAllowedTypes'
GelatoReportDocumentOptionsAllowedTypes'Other Value
val
      )