{-# 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 LegalEntityPersonVerificationDocument
module StripeAPI.Types.LegalEntityPersonVerificationDocument 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 {-# SOURCE #-} StripeAPI.Types.File
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.legal_entity_person_verification_document@ in the specification.
data LegalEntityPersonVerificationDocument = LegalEntityPersonVerificationDocument
  { -- | back: The back of an ID returned by a [file upload](https:\/\/stripe.com\/docs\/api\#create_file) with a \`purpose\` value of \`identity_document\`.
    LegalEntityPersonVerificationDocument
-> Maybe LegalEntityPersonVerificationDocumentBack'Variants
legalEntityPersonVerificationDocumentBack :: (GHC.Maybe.Maybe LegalEntityPersonVerificationDocumentBack'Variants),
    -- | details: A user-displayable string describing the verification state of this document. For example, if a document is uploaded and the picture is too fuzzy, this may say \"Identity document is too unclear to read\".
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LegalEntityPersonVerificationDocument -> Maybe Text
legalEntityPersonVerificationDocumentDetails :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | details_code: One of \`document_corrupt\`, \`document_country_not_supported\`, \`document_expired\`, \`document_failed_copy\`, \`document_failed_other\`, \`document_failed_test_mode\`, \`document_fraudulent\`, \`document_failed_greyscale\`, \`document_incomplete\`, \`document_invalid\`, \`document_manipulated\`, \`document_missing_back\`, \`document_missing_front\`, \`document_not_readable\`, \`document_not_uploaded\`, \`document_photo_mismatch\`, \`document_too_large\`, or \`document_type_not_supported\`. A machine-readable code specifying the verification state for this document.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    LegalEntityPersonVerificationDocument -> Maybe Text
legalEntityPersonVerificationDocumentDetailsCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | front: The front of an ID returned by a [file upload](https:\/\/stripe.com\/docs\/api\#create_file) with a \`purpose\` value of \`identity_document\`.
    LegalEntityPersonVerificationDocument
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
legalEntityPersonVerificationDocumentFront :: (GHC.Maybe.Maybe LegalEntityPersonVerificationDocumentFront'Variants)
  }
  deriving
    ( Int -> LegalEntityPersonVerificationDocument -> ShowS
[LegalEntityPersonVerificationDocument] -> ShowS
LegalEntityPersonVerificationDocument -> String
(Int -> LegalEntityPersonVerificationDocument -> ShowS)
-> (LegalEntityPersonVerificationDocument -> String)
-> ([LegalEntityPersonVerificationDocument] -> ShowS)
-> Show LegalEntityPersonVerificationDocument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LegalEntityPersonVerificationDocument] -> ShowS
$cshowList :: [LegalEntityPersonVerificationDocument] -> ShowS
show :: LegalEntityPersonVerificationDocument -> String
$cshow :: LegalEntityPersonVerificationDocument -> String
showsPrec :: Int -> LegalEntityPersonVerificationDocument -> ShowS
$cshowsPrec :: Int -> LegalEntityPersonVerificationDocument -> ShowS
GHC.Show.Show,
      LegalEntityPersonVerificationDocument
-> LegalEntityPersonVerificationDocument -> Bool
(LegalEntityPersonVerificationDocument
 -> LegalEntityPersonVerificationDocument -> Bool)
-> (LegalEntityPersonVerificationDocument
    -> LegalEntityPersonVerificationDocument -> Bool)
-> Eq LegalEntityPersonVerificationDocument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LegalEntityPersonVerificationDocument
-> LegalEntityPersonVerificationDocument -> Bool
$c/= :: LegalEntityPersonVerificationDocument
-> LegalEntityPersonVerificationDocument -> Bool
== :: LegalEntityPersonVerificationDocument
-> LegalEntityPersonVerificationDocument -> Bool
$c== :: LegalEntityPersonVerificationDocument
-> LegalEntityPersonVerificationDocument -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON LegalEntityPersonVerificationDocument where
  toJSON :: LegalEntityPersonVerificationDocument -> Value
toJSON LegalEntityPersonVerificationDocument
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"back" Text
-> Maybe LegalEntityPersonVerificationDocumentBack'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument
-> Maybe LegalEntityPersonVerificationDocumentBack'Variants
legalEntityPersonVerificationDocumentBack LegalEntityPersonVerificationDocument
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"details" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument -> Maybe Text
legalEntityPersonVerificationDocumentDetails LegalEntityPersonVerificationDocument
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"details_code" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument -> Maybe Text
legalEntityPersonVerificationDocumentDetailsCode LegalEntityPersonVerificationDocument
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"front" Text
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
-> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
legalEntityPersonVerificationDocumentFront LegalEntityPersonVerificationDocument
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: LegalEntityPersonVerificationDocument -> Encoding
toEncoding LegalEntityPersonVerificationDocument
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"back" Text
-> Maybe LegalEntityPersonVerificationDocumentBack'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument
-> Maybe LegalEntityPersonVerificationDocumentBack'Variants
legalEntityPersonVerificationDocumentBack LegalEntityPersonVerificationDocument
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"details" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument -> Maybe Text
legalEntityPersonVerificationDocumentDetails LegalEntityPersonVerificationDocument
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"details_code" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument -> Maybe Text
legalEntityPersonVerificationDocumentDetailsCode LegalEntityPersonVerificationDocument
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"front" Text
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
-> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= LegalEntityPersonVerificationDocument
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
legalEntityPersonVerificationDocumentFront LegalEntityPersonVerificationDocument
obj))))

instance Data.Aeson.Types.FromJSON.FromJSON LegalEntityPersonVerificationDocument where
  parseJSON :: Value -> Parser LegalEntityPersonVerificationDocument
parseJSON = String
-> (Object -> Parser LegalEntityPersonVerificationDocument)
-> Value
-> Parser LegalEntityPersonVerificationDocument
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"LegalEntityPersonVerificationDocument" (\Object
obj -> ((((Maybe LegalEntityPersonVerificationDocumentBack'Variants
 -> Maybe Text
 -> Maybe Text
 -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
 -> LegalEntityPersonVerificationDocument)
-> Parser
     (Maybe LegalEntityPersonVerificationDocumentBack'Variants
      -> Maybe Text
      -> Maybe Text
      -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
      -> LegalEntityPersonVerificationDocument)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe LegalEntityPersonVerificationDocumentBack'Variants
-> Maybe Text
-> Maybe Text
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocument
LegalEntityPersonVerificationDocument Parser
  (Maybe LegalEntityPersonVerificationDocumentBack'Variants
   -> Maybe Text
   -> Maybe Text
   -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
   -> LegalEntityPersonVerificationDocument)
-> Parser
     (Maybe LegalEntityPersonVerificationDocumentBack'Variants)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
      -> LegalEntityPersonVerificationDocument)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe LegalEntityPersonVerificationDocumentBack'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"back")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
   -> LegalEntityPersonVerificationDocument)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
      -> LegalEntityPersonVerificationDocument)
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
"details")) Parser
  (Maybe Text
   -> Maybe LegalEntityPersonVerificationDocumentFront'Variants
   -> LegalEntityPersonVerificationDocument)
-> Parser (Maybe Text)
-> Parser
     (Maybe LegalEntityPersonVerificationDocumentFront'Variants
      -> LegalEntityPersonVerificationDocument)
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
"details_code")) Parser
  (Maybe LegalEntityPersonVerificationDocumentFront'Variants
   -> LegalEntityPersonVerificationDocument)
-> Parser
     (Maybe LegalEntityPersonVerificationDocumentFront'Variants)
-> Parser LegalEntityPersonVerificationDocument
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text
-> Parser
     (Maybe LegalEntityPersonVerificationDocumentFront'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"front"))

-- | Create a new 'LegalEntityPersonVerificationDocument' with all required fields.
mkLegalEntityPersonVerificationDocument :: LegalEntityPersonVerificationDocument
mkLegalEntityPersonVerificationDocument :: LegalEntityPersonVerificationDocument
mkLegalEntityPersonVerificationDocument =
  LegalEntityPersonVerificationDocument :: Maybe LegalEntityPersonVerificationDocumentBack'Variants
-> Maybe Text
-> Maybe Text
-> Maybe LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocument
LegalEntityPersonVerificationDocument
    { legalEntityPersonVerificationDocumentBack :: Maybe LegalEntityPersonVerificationDocumentBack'Variants
legalEntityPersonVerificationDocumentBack = Maybe LegalEntityPersonVerificationDocumentBack'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      legalEntityPersonVerificationDocumentDetails :: Maybe Text
legalEntityPersonVerificationDocumentDetails = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      legalEntityPersonVerificationDocumentDetailsCode :: Maybe Text
legalEntityPersonVerificationDocumentDetailsCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      legalEntityPersonVerificationDocumentFront :: Maybe LegalEntityPersonVerificationDocumentFront'Variants
legalEntityPersonVerificationDocumentFront = Maybe LegalEntityPersonVerificationDocumentFront'Variants
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @components.schemas.legal_entity_person_verification_document.properties.back.anyOf@ in the specification.
--
-- The back of an ID returned by a [file upload](https:\/\/stripe.com\/docs\/api\#create_file) with a \`purpose\` value of \`identity_document\`.
data LegalEntityPersonVerificationDocumentBack'Variants
  = LegalEntityPersonVerificationDocumentBack'Text Data.Text.Internal.Text
  | LegalEntityPersonVerificationDocumentBack'File File
  deriving (Int -> LegalEntityPersonVerificationDocumentBack'Variants -> ShowS
[LegalEntityPersonVerificationDocumentBack'Variants] -> ShowS
LegalEntityPersonVerificationDocumentBack'Variants -> String
(Int
 -> LegalEntityPersonVerificationDocumentBack'Variants -> ShowS)
-> (LegalEntityPersonVerificationDocumentBack'Variants -> String)
-> ([LegalEntityPersonVerificationDocumentBack'Variants] -> ShowS)
-> Show LegalEntityPersonVerificationDocumentBack'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LegalEntityPersonVerificationDocumentBack'Variants] -> ShowS
$cshowList :: [LegalEntityPersonVerificationDocumentBack'Variants] -> ShowS
show :: LegalEntityPersonVerificationDocumentBack'Variants -> String
$cshow :: LegalEntityPersonVerificationDocumentBack'Variants -> String
showsPrec :: Int -> LegalEntityPersonVerificationDocumentBack'Variants -> ShowS
$cshowsPrec :: Int -> LegalEntityPersonVerificationDocumentBack'Variants -> ShowS
GHC.Show.Show, LegalEntityPersonVerificationDocumentBack'Variants
-> LegalEntityPersonVerificationDocumentBack'Variants -> Bool
(LegalEntityPersonVerificationDocumentBack'Variants
 -> LegalEntityPersonVerificationDocumentBack'Variants -> Bool)
-> (LegalEntityPersonVerificationDocumentBack'Variants
    -> LegalEntityPersonVerificationDocumentBack'Variants -> Bool)
-> Eq LegalEntityPersonVerificationDocumentBack'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LegalEntityPersonVerificationDocumentBack'Variants
-> LegalEntityPersonVerificationDocumentBack'Variants -> Bool
$c/= :: LegalEntityPersonVerificationDocumentBack'Variants
-> LegalEntityPersonVerificationDocumentBack'Variants -> Bool
== :: LegalEntityPersonVerificationDocumentBack'Variants
-> LegalEntityPersonVerificationDocumentBack'Variants -> Bool
$c== :: LegalEntityPersonVerificationDocumentBack'Variants
-> LegalEntityPersonVerificationDocumentBack'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON LegalEntityPersonVerificationDocumentBack'Variants where
  toJSON :: LegalEntityPersonVerificationDocumentBack'Variants -> Value
toJSON (LegalEntityPersonVerificationDocumentBack'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (LegalEntityPersonVerificationDocumentBack'File File
a) = File -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON File
a

instance Data.Aeson.Types.FromJSON.FromJSON LegalEntityPersonVerificationDocumentBack'Variants where
  parseJSON :: Value -> Parser LegalEntityPersonVerificationDocumentBack'Variants
parseJSON Value
val = case (Text -> LegalEntityPersonVerificationDocumentBack'Variants
LegalEntityPersonVerificationDocumentBack'Text (Text -> LegalEntityPersonVerificationDocumentBack'Variants)
-> Result Text
-> Result LegalEntityPersonVerificationDocumentBack'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result LegalEntityPersonVerificationDocumentBack'Variants
-> Result LegalEntityPersonVerificationDocumentBack'Variants
-> Result LegalEntityPersonVerificationDocumentBack'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((File -> LegalEntityPersonVerificationDocumentBack'Variants
LegalEntityPersonVerificationDocumentBack'File (File -> LegalEntityPersonVerificationDocumentBack'Variants)
-> Result File
-> Result LegalEntityPersonVerificationDocumentBack'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result File
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result LegalEntityPersonVerificationDocumentBack'Variants
-> Result LegalEntityPersonVerificationDocumentBack'Variants
-> Result LegalEntityPersonVerificationDocumentBack'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result LegalEntityPersonVerificationDocumentBack'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success LegalEntityPersonVerificationDocumentBack'Variants
a -> LegalEntityPersonVerificationDocumentBack'Variants
-> Parser LegalEntityPersonVerificationDocumentBack'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure LegalEntityPersonVerificationDocumentBack'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser LegalEntityPersonVerificationDocumentBack'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a

-- | Defines the oneOf schema located at @components.schemas.legal_entity_person_verification_document.properties.front.anyOf@ in the specification.
--
-- The front of an ID returned by a [file upload](https:\/\/stripe.com\/docs\/api\#create_file) with a \`purpose\` value of \`identity_document\`.
data LegalEntityPersonVerificationDocumentFront'Variants
  = LegalEntityPersonVerificationDocumentFront'Text Data.Text.Internal.Text
  | LegalEntityPersonVerificationDocumentFront'File File
  deriving (Int -> LegalEntityPersonVerificationDocumentFront'Variants -> ShowS
[LegalEntityPersonVerificationDocumentFront'Variants] -> ShowS
LegalEntityPersonVerificationDocumentFront'Variants -> String
(Int
 -> LegalEntityPersonVerificationDocumentFront'Variants -> ShowS)
-> (LegalEntityPersonVerificationDocumentFront'Variants -> String)
-> ([LegalEntityPersonVerificationDocumentFront'Variants] -> ShowS)
-> Show LegalEntityPersonVerificationDocumentFront'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LegalEntityPersonVerificationDocumentFront'Variants] -> ShowS
$cshowList :: [LegalEntityPersonVerificationDocumentFront'Variants] -> ShowS
show :: LegalEntityPersonVerificationDocumentFront'Variants -> String
$cshow :: LegalEntityPersonVerificationDocumentFront'Variants -> String
showsPrec :: Int -> LegalEntityPersonVerificationDocumentFront'Variants -> ShowS
$cshowsPrec :: Int -> LegalEntityPersonVerificationDocumentFront'Variants -> ShowS
GHC.Show.Show, LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocumentFront'Variants -> Bool
(LegalEntityPersonVerificationDocumentFront'Variants
 -> LegalEntityPersonVerificationDocumentFront'Variants -> Bool)
-> (LegalEntityPersonVerificationDocumentFront'Variants
    -> LegalEntityPersonVerificationDocumentFront'Variants -> Bool)
-> Eq LegalEntityPersonVerificationDocumentFront'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocumentFront'Variants -> Bool
$c/= :: LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocumentFront'Variants -> Bool
== :: LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocumentFront'Variants -> Bool
$c== :: LegalEntityPersonVerificationDocumentFront'Variants
-> LegalEntityPersonVerificationDocumentFront'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON LegalEntityPersonVerificationDocumentFront'Variants where
  toJSON :: LegalEntityPersonVerificationDocumentFront'Variants -> Value
toJSON (LegalEntityPersonVerificationDocumentFront'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (LegalEntityPersonVerificationDocumentFront'File File
a) = File -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON File
a

instance Data.Aeson.Types.FromJSON.FromJSON LegalEntityPersonVerificationDocumentFront'Variants where
  parseJSON :: Value -> Parser LegalEntityPersonVerificationDocumentFront'Variants
parseJSON Value
val = case (Text -> LegalEntityPersonVerificationDocumentFront'Variants
LegalEntityPersonVerificationDocumentFront'Text (Text -> LegalEntityPersonVerificationDocumentFront'Variants)
-> Result Text
-> Result LegalEntityPersonVerificationDocumentFront'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result LegalEntityPersonVerificationDocumentFront'Variants
-> Result LegalEntityPersonVerificationDocumentFront'Variants
-> Result LegalEntityPersonVerificationDocumentFront'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((File -> LegalEntityPersonVerificationDocumentFront'Variants
LegalEntityPersonVerificationDocumentFront'File (File -> LegalEntityPersonVerificationDocumentFront'Variants)
-> Result File
-> Result LegalEntityPersonVerificationDocumentFront'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result File
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result LegalEntityPersonVerificationDocumentFront'Variants
-> Result LegalEntityPersonVerificationDocumentFront'Variants
-> Result LegalEntityPersonVerificationDocumentFront'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String
-> Result LegalEntityPersonVerificationDocumentFront'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success LegalEntityPersonVerificationDocumentFront'Variants
a -> LegalEntityPersonVerificationDocumentFront'Variants
-> Parser LegalEntityPersonVerificationDocumentFront'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure LegalEntityPersonVerificationDocumentFront'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String
-> Parser LegalEntityPersonVerificationDocumentFront'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a