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

-- | Defines the object schema located at @components.schemas.tax_id@ in the specification.
--
-- You can add one or multiple tax IDs to a [customer](https:\/\/stripe.com\/docs\/api\/customers).
-- A customer\'s tax IDs are displayed on invoices and credit notes issued for the customer.
--
-- Related guide: [Customer Tax Identification Numbers](https:\/\/stripe.com\/docs\/billing\/taxes\/tax-ids).
data TaxId = TaxId
  { -- | country: Two-letter ISO code representing the country of the tax ID.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    TaxId -> Maybe Text
taxIdCountry :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | created: Time at which the object was created. Measured in seconds since the Unix epoch.
    TaxId -> Int
taxIdCreated :: GHC.Types.Int,
    -- | customer: ID of the customer.
    TaxId -> Maybe TaxIdCustomer'Variants
taxIdCustomer :: (GHC.Maybe.Maybe TaxIdCustomer'Variants),
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    TaxId -> Text
taxIdId :: Data.Text.Internal.Text,
    -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.
    TaxId -> Bool
taxIdLivemode :: GHC.Types.Bool,
    -- | type: Type of the tax ID, one of \`ae_trn\`, \`au_abn\`, \`br_cnpj\`, \`br_cpf\`, \`ca_bn\`, \`ca_gst_hst\`, \`ca_pst_bc\`, \`ca_pst_mb\`, \`ca_pst_sk\`, \`ca_qst\`, \`ch_vat\`, \`cl_tin\`, \`es_cif\`, \`eu_vat\`, \`gb_vat\`, \`hk_br\`, \`id_npwp\`, \`il_vat\`, \`in_gst\`, \`jp_cn\`, \`jp_rn\`, \`kr_brn\`, \`li_uid\`, \`mx_rfc\`, \`my_frp\`, \`my_itn\`, \`my_sst\`, \`no_vat\`, \`nz_gst\`, \`ru_inn\`, \`ru_kpp\`, \`sa_vat\`, \`sg_gst\`, \`sg_uen\`, \`th_vat\`, \`tw_vat\`, \`us_ein\`, or \`za_vat\`. Note that some legacy tax IDs have type \`unknown\`
    TaxId -> TaxIdType'
taxIdType :: TaxIdType',
    -- | value: Value of the tax ID.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    TaxId -> Text
taxIdValue :: Data.Text.Internal.Text,
    -- | verification: Tax ID verification information.
    TaxId -> Maybe TaxIdVerification'
taxIdVerification :: (GHC.Maybe.Maybe TaxIdVerification')
  }
  deriving
    ( Int -> TaxId -> ShowS
[TaxId] -> ShowS
TaxId -> String
(Int -> TaxId -> ShowS)
-> (TaxId -> String) -> ([TaxId] -> ShowS) -> Show TaxId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaxId] -> ShowS
$cshowList :: [TaxId] -> ShowS
show :: TaxId -> String
$cshow :: TaxId -> String
showsPrec :: Int -> TaxId -> ShowS
$cshowsPrec :: Int -> TaxId -> ShowS
GHC.Show.Show,
      TaxId -> TaxId -> Bool
(TaxId -> TaxId -> Bool) -> (TaxId -> TaxId -> Bool) -> Eq TaxId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaxId -> TaxId -> Bool
$c/= :: TaxId -> TaxId -> Bool
== :: TaxId -> TaxId -> Bool
$c== :: TaxId -> TaxId -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON TaxId where
  toJSON :: TaxId -> Value
toJSON TaxId
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"country" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Maybe Text
taxIdCountry TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"created" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Int
taxIdCreated TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"customer" Text -> Maybe TaxIdCustomer'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Maybe TaxIdCustomer'Variants
taxIdCustomer TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Text
taxIdId TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Bool
taxIdLivemode TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"type" Text -> TaxIdType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> TaxIdType'
taxIdType TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Text
taxIdValue TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"verification" Text -> Maybe TaxIdVerification' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Maybe TaxIdVerification'
taxIdVerification TaxId
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"tax_id" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: TaxId -> Encoding
toEncoding TaxId
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"country" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Maybe Text
taxIdCountry TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"created" Text -> Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Int
taxIdCreated TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"customer" Text -> Maybe TaxIdCustomer'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Maybe TaxIdCustomer'Variants
taxIdCustomer TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Text
taxIdId TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Bool
taxIdLivemode TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"type" Text -> TaxIdType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> TaxIdType'
taxIdType TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"value" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Text
taxIdValue TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"verification" Text -> Maybe TaxIdVerification' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxId -> Maybe TaxIdVerification'
taxIdVerification TaxId
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"tax_id")))))))))

instance Data.Aeson.Types.FromJSON.FromJSON TaxId where
  parseJSON :: Value -> Parser TaxId
parseJSON = String -> (Object -> Parser TaxId) -> Value -> Parser TaxId
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"TaxId" (\Object
obj -> ((((((((Maybe Text
 -> Int
 -> Maybe TaxIdCustomer'Variants
 -> Text
 -> Bool
 -> TaxIdType'
 -> Text
 -> Maybe TaxIdVerification'
 -> TaxId)
-> Parser
     (Maybe Text
      -> Int
      -> Maybe TaxIdCustomer'Variants
      -> Text
      -> Bool
      -> TaxIdType'
      -> Text
      -> Maybe TaxIdVerification'
      -> TaxId)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Int
-> Maybe TaxIdCustomer'Variants
-> Text
-> Bool
-> TaxIdType'
-> Text
-> Maybe TaxIdVerification'
-> TaxId
TaxId Parser
  (Maybe Text
   -> Int
   -> Maybe TaxIdCustomer'Variants
   -> Text
   -> Bool
   -> TaxIdType'
   -> Text
   -> Maybe TaxIdVerification'
   -> TaxId)
-> Parser (Maybe Text)
-> Parser
     (Int
      -> Maybe TaxIdCustomer'Variants
      -> Text
      -> Bool
      -> TaxIdType'
      -> Text
      -> Maybe TaxIdVerification'
      -> TaxId)
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
"country")) Parser
  (Int
   -> Maybe TaxIdCustomer'Variants
   -> Text
   -> Bool
   -> TaxIdType'
   -> Text
   -> Maybe TaxIdVerification'
   -> TaxId)
-> Parser Int
-> Parser
     (Maybe TaxIdCustomer'Variants
      -> Text
      -> Bool
      -> TaxIdType'
      -> Text
      -> Maybe TaxIdVerification'
      -> TaxId)
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
"created")) Parser
  (Maybe TaxIdCustomer'Variants
   -> Text
   -> Bool
   -> TaxIdType'
   -> Text
   -> Maybe TaxIdVerification'
   -> TaxId)
-> Parser (Maybe TaxIdCustomer'Variants)
-> Parser
     (Text
      -> Bool -> TaxIdType' -> Text -> Maybe TaxIdVerification' -> TaxId)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe TaxIdCustomer'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"customer")) Parser
  (Text
   -> Bool -> TaxIdType' -> Text -> Maybe TaxIdVerification' -> TaxId)
-> Parser Text
-> Parser
     (Bool -> TaxIdType' -> Text -> Maybe TaxIdVerification' -> TaxId)
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
"id")) Parser
  (Bool -> TaxIdType' -> Text -> Maybe TaxIdVerification' -> TaxId)
-> Parser Bool
-> Parser (TaxIdType' -> Text -> Maybe TaxIdVerification' -> TaxId)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"livemode")) Parser (TaxIdType' -> Text -> Maybe TaxIdVerification' -> TaxId)
-> Parser TaxIdType'
-> Parser (Text -> Maybe TaxIdVerification' -> TaxId)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser TaxIdType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"type")) Parser (Text -> Maybe TaxIdVerification' -> TaxId)
-> Parser Text -> Parser (Maybe TaxIdVerification' -> TaxId)
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
"value")) Parser (Maybe TaxIdVerification' -> TaxId)
-> Parser (Maybe TaxIdVerification') -> Parser TaxId
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe TaxIdVerification')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"verification"))

-- | Create a new 'TaxId' with all required fields.
mkTaxId ::
  -- | 'taxIdCreated'
  GHC.Types.Int ->
  -- | 'taxIdId'
  Data.Text.Internal.Text ->
  -- | 'taxIdLivemode'
  GHC.Types.Bool ->
  -- | 'taxIdType'
  TaxIdType' ->
  -- | 'taxIdValue'
  Data.Text.Internal.Text ->
  TaxId
mkTaxId :: Int -> Text -> Bool -> TaxIdType' -> Text -> TaxId
mkTaxId Int
taxIdCreated Text
taxIdId Bool
taxIdLivemode TaxIdType'
taxIdType Text
taxIdValue =
  TaxId :: Maybe Text
-> Int
-> Maybe TaxIdCustomer'Variants
-> Text
-> Bool
-> TaxIdType'
-> Text
-> Maybe TaxIdVerification'
-> TaxId
TaxId
    { taxIdCountry :: Maybe Text
taxIdCountry = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      taxIdCreated :: Int
taxIdCreated = Int
taxIdCreated,
      taxIdCustomer :: Maybe TaxIdCustomer'Variants
taxIdCustomer = Maybe TaxIdCustomer'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      taxIdId :: Text
taxIdId = Text
taxIdId,
      taxIdLivemode :: Bool
taxIdLivemode = Bool
taxIdLivemode,
      taxIdType :: TaxIdType'
taxIdType = TaxIdType'
taxIdType,
      taxIdValue :: Text
taxIdValue = Text
taxIdValue,
      taxIdVerification :: Maybe TaxIdVerification'
taxIdVerification = Maybe TaxIdVerification'
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the oneOf schema located at @components.schemas.tax_id.properties.customer.anyOf@ in the specification.
--
-- ID of the customer.
data TaxIdCustomer'Variants
  = TaxIdCustomer'Text Data.Text.Internal.Text
  | TaxIdCustomer'Customer Customer
  deriving (Int -> TaxIdCustomer'Variants -> ShowS
[TaxIdCustomer'Variants] -> ShowS
TaxIdCustomer'Variants -> String
(Int -> TaxIdCustomer'Variants -> ShowS)
-> (TaxIdCustomer'Variants -> String)
-> ([TaxIdCustomer'Variants] -> ShowS)
-> Show TaxIdCustomer'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaxIdCustomer'Variants] -> ShowS
$cshowList :: [TaxIdCustomer'Variants] -> ShowS
show :: TaxIdCustomer'Variants -> String
$cshow :: TaxIdCustomer'Variants -> String
showsPrec :: Int -> TaxIdCustomer'Variants -> ShowS
$cshowsPrec :: Int -> TaxIdCustomer'Variants -> ShowS
GHC.Show.Show, TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool
(TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool)
-> (TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool)
-> Eq TaxIdCustomer'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool
$c/= :: TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool
== :: TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool
$c== :: TaxIdCustomer'Variants -> TaxIdCustomer'Variants -> Bool
GHC.Classes.Eq)

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

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

-- | Defines the enum schema located at @components.schemas.tax_id.properties.type@ in the specification.
--
-- Type of the tax ID, one of \`ae_trn\`, \`au_abn\`, \`br_cnpj\`, \`br_cpf\`, \`ca_bn\`, \`ca_gst_hst\`, \`ca_pst_bc\`, \`ca_pst_mb\`, \`ca_pst_sk\`, \`ca_qst\`, \`ch_vat\`, \`cl_tin\`, \`es_cif\`, \`eu_vat\`, \`gb_vat\`, \`hk_br\`, \`id_npwp\`, \`il_vat\`, \`in_gst\`, \`jp_cn\`, \`jp_rn\`, \`kr_brn\`, \`li_uid\`, \`mx_rfc\`, \`my_frp\`, \`my_itn\`, \`my_sst\`, \`no_vat\`, \`nz_gst\`, \`ru_inn\`, \`ru_kpp\`, \`sa_vat\`, \`sg_gst\`, \`sg_uen\`, \`th_vat\`, \`tw_vat\`, \`us_ein\`, or \`za_vat\`. Note that some legacy tax IDs have type \`unknown\`
data TaxIdType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    TaxIdType'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.
    TaxIdType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"ae_trn"@
    TaxIdType'EnumAeTrn
  | -- | Represents the JSON value @"au_abn"@
    TaxIdType'EnumAuAbn
  | -- | Represents the JSON value @"br_cnpj"@
    TaxIdType'EnumBrCnpj
  | -- | Represents the JSON value @"br_cpf"@
    TaxIdType'EnumBrCpf
  | -- | Represents the JSON value @"ca_bn"@
    TaxIdType'EnumCaBn
  | -- | Represents the JSON value @"ca_gst_hst"@
    TaxIdType'EnumCaGstHst
  | -- | Represents the JSON value @"ca_pst_bc"@
    TaxIdType'EnumCaPstBc
  | -- | Represents the JSON value @"ca_pst_mb"@
    TaxIdType'EnumCaPstMb
  | -- | Represents the JSON value @"ca_pst_sk"@
    TaxIdType'EnumCaPstSk
  | -- | Represents the JSON value @"ca_qst"@
    TaxIdType'EnumCaQst
  | -- | Represents the JSON value @"ch_vat"@
    TaxIdType'EnumChVat
  | -- | Represents the JSON value @"cl_tin"@
    TaxIdType'EnumClTin
  | -- | Represents the JSON value @"es_cif"@
    TaxIdType'EnumEsCif
  | -- | Represents the JSON value @"eu_vat"@
    TaxIdType'EnumEuVat
  | -- | Represents the JSON value @"gb_vat"@
    TaxIdType'EnumGbVat
  | -- | Represents the JSON value @"hk_br"@
    TaxIdType'EnumHkBr
  | -- | Represents the JSON value @"id_npwp"@
    TaxIdType'EnumIdNpwp
  | -- | Represents the JSON value @"il_vat"@
    TaxIdType'EnumIlVat
  | -- | Represents the JSON value @"in_gst"@
    TaxIdType'EnumInGst
  | -- | Represents the JSON value @"jp_cn"@
    TaxIdType'EnumJpCn
  | -- | Represents the JSON value @"jp_rn"@
    TaxIdType'EnumJpRn
  | -- | Represents the JSON value @"kr_brn"@
    TaxIdType'EnumKrBrn
  | -- | Represents the JSON value @"li_uid"@
    TaxIdType'EnumLiUid
  | -- | Represents the JSON value @"mx_rfc"@
    TaxIdType'EnumMxRfc
  | -- | Represents the JSON value @"my_frp"@
    TaxIdType'EnumMyFrp
  | -- | Represents the JSON value @"my_itn"@
    TaxIdType'EnumMyItn
  | -- | Represents the JSON value @"my_sst"@
    TaxIdType'EnumMySst
  | -- | Represents the JSON value @"no_vat"@
    TaxIdType'EnumNoVat
  | -- | Represents the JSON value @"nz_gst"@
    TaxIdType'EnumNzGst
  | -- | Represents the JSON value @"ru_inn"@
    TaxIdType'EnumRuInn
  | -- | Represents the JSON value @"ru_kpp"@
    TaxIdType'EnumRuKpp
  | -- | Represents the JSON value @"sa_vat"@
    TaxIdType'EnumSaVat
  | -- | Represents the JSON value @"sg_gst"@
    TaxIdType'EnumSgGst
  | -- | Represents the JSON value @"sg_uen"@
    TaxIdType'EnumSgUen
  | -- | Represents the JSON value @"th_vat"@
    TaxIdType'EnumThVat
  | -- | Represents the JSON value @"tw_vat"@
    TaxIdType'EnumTwVat
  | -- | Represents the JSON value @"unknown"@
    TaxIdType'EnumUnknown
  | -- | Represents the JSON value @"us_ein"@
    TaxIdType'EnumUsEin
  | -- | Represents the JSON value @"za_vat"@
    TaxIdType'EnumZaVat
  deriving (Int -> TaxIdType' -> ShowS
[TaxIdType'] -> ShowS
TaxIdType' -> String
(Int -> TaxIdType' -> ShowS)
-> (TaxIdType' -> String)
-> ([TaxIdType'] -> ShowS)
-> Show TaxIdType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaxIdType'] -> ShowS
$cshowList :: [TaxIdType'] -> ShowS
show :: TaxIdType' -> String
$cshow :: TaxIdType' -> String
showsPrec :: Int -> TaxIdType' -> ShowS
$cshowsPrec :: Int -> TaxIdType' -> ShowS
GHC.Show.Show, TaxIdType' -> TaxIdType' -> Bool
(TaxIdType' -> TaxIdType' -> Bool)
-> (TaxIdType' -> TaxIdType' -> Bool) -> Eq TaxIdType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaxIdType' -> TaxIdType' -> Bool
$c/= :: TaxIdType' -> TaxIdType' -> Bool
== :: TaxIdType' -> TaxIdType' -> Bool
$c== :: TaxIdType' -> TaxIdType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON TaxIdType' where
  toJSON :: TaxIdType' -> Value
toJSON (TaxIdType'Other Value
val) = Value
val
  toJSON (TaxIdType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (TaxIdType'
TaxIdType'EnumAeTrn) = Value
"ae_trn"
  toJSON (TaxIdType'
TaxIdType'EnumAuAbn) = Value
"au_abn"
  toJSON (TaxIdType'
TaxIdType'EnumBrCnpj) = Value
"br_cnpj"
  toJSON (TaxIdType'
TaxIdType'EnumBrCpf) = Value
"br_cpf"
  toJSON (TaxIdType'
TaxIdType'EnumCaBn) = Value
"ca_bn"
  toJSON (TaxIdType'
TaxIdType'EnumCaGstHst) = Value
"ca_gst_hst"
  toJSON (TaxIdType'
TaxIdType'EnumCaPstBc) = Value
"ca_pst_bc"
  toJSON (TaxIdType'
TaxIdType'EnumCaPstMb) = Value
"ca_pst_mb"
  toJSON (TaxIdType'
TaxIdType'EnumCaPstSk) = Value
"ca_pst_sk"
  toJSON (TaxIdType'
TaxIdType'EnumCaQst) = Value
"ca_qst"
  toJSON (TaxIdType'
TaxIdType'EnumChVat) = Value
"ch_vat"
  toJSON (TaxIdType'
TaxIdType'EnumClTin) = Value
"cl_tin"
  toJSON (TaxIdType'
TaxIdType'EnumEsCif) = Value
"es_cif"
  toJSON (TaxIdType'
TaxIdType'EnumEuVat) = Value
"eu_vat"
  toJSON (TaxIdType'
TaxIdType'EnumGbVat) = Value
"gb_vat"
  toJSON (TaxIdType'
TaxIdType'EnumHkBr) = Value
"hk_br"
  toJSON (TaxIdType'
TaxIdType'EnumIdNpwp) = Value
"id_npwp"
  toJSON (TaxIdType'
TaxIdType'EnumIlVat) = Value
"il_vat"
  toJSON (TaxIdType'
TaxIdType'EnumInGst) = Value
"in_gst"
  toJSON (TaxIdType'
TaxIdType'EnumJpCn) = Value
"jp_cn"
  toJSON (TaxIdType'
TaxIdType'EnumJpRn) = Value
"jp_rn"
  toJSON (TaxIdType'
TaxIdType'EnumKrBrn) = Value
"kr_brn"
  toJSON (TaxIdType'
TaxIdType'EnumLiUid) = Value
"li_uid"
  toJSON (TaxIdType'
TaxIdType'EnumMxRfc) = Value
"mx_rfc"
  toJSON (TaxIdType'
TaxIdType'EnumMyFrp) = Value
"my_frp"
  toJSON (TaxIdType'
TaxIdType'EnumMyItn) = Value
"my_itn"
  toJSON (TaxIdType'
TaxIdType'EnumMySst) = Value
"my_sst"
  toJSON (TaxIdType'
TaxIdType'EnumNoVat) = Value
"no_vat"
  toJSON (TaxIdType'
TaxIdType'EnumNzGst) = Value
"nz_gst"
  toJSON (TaxIdType'
TaxIdType'EnumRuInn) = Value
"ru_inn"
  toJSON (TaxIdType'
TaxIdType'EnumRuKpp) = Value
"ru_kpp"
  toJSON (TaxIdType'
TaxIdType'EnumSaVat) = Value
"sa_vat"
  toJSON (TaxIdType'
TaxIdType'EnumSgGst) = Value
"sg_gst"
  toJSON (TaxIdType'
TaxIdType'EnumSgUen) = Value
"sg_uen"
  toJSON (TaxIdType'
TaxIdType'EnumThVat) = Value
"th_vat"
  toJSON (TaxIdType'
TaxIdType'EnumTwVat) = Value
"tw_vat"
  toJSON (TaxIdType'
TaxIdType'EnumUnknown) = Value
"unknown"
  toJSON (TaxIdType'
TaxIdType'EnumUsEin) = Value
"us_ein"
  toJSON (TaxIdType'
TaxIdType'EnumZaVat) = Value
"za_vat"

instance Data.Aeson.Types.FromJSON.FromJSON TaxIdType' where
  parseJSON :: Value -> Parser TaxIdType'
parseJSON Value
val =
    TaxIdType' -> Parser TaxIdType'
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
"ae_trn" -> TaxIdType'
TaxIdType'EnumAeTrn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"au_abn" -> TaxIdType'
TaxIdType'EnumAuAbn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"br_cnpj" -> TaxIdType'
TaxIdType'EnumBrCnpj
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"br_cpf" -> TaxIdType'
TaxIdType'EnumBrCpf
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ca_bn" -> TaxIdType'
TaxIdType'EnumCaBn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ca_gst_hst" -> TaxIdType'
TaxIdType'EnumCaGstHst
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ca_pst_bc" -> TaxIdType'
TaxIdType'EnumCaPstBc
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ca_pst_mb" -> TaxIdType'
TaxIdType'EnumCaPstMb
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ca_pst_sk" -> TaxIdType'
TaxIdType'EnumCaPstSk
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ca_qst" -> TaxIdType'
TaxIdType'EnumCaQst
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ch_vat" -> TaxIdType'
TaxIdType'EnumChVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"cl_tin" -> TaxIdType'
TaxIdType'EnumClTin
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"es_cif" -> TaxIdType'
TaxIdType'EnumEsCif
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"eu_vat" -> TaxIdType'
TaxIdType'EnumEuVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"gb_vat" -> TaxIdType'
TaxIdType'EnumGbVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"hk_br" -> TaxIdType'
TaxIdType'EnumHkBr
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"id_npwp" -> TaxIdType'
TaxIdType'EnumIdNpwp
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"il_vat" -> TaxIdType'
TaxIdType'EnumIlVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"in_gst" -> TaxIdType'
TaxIdType'EnumInGst
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"jp_cn" -> TaxIdType'
TaxIdType'EnumJpCn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"jp_rn" -> TaxIdType'
TaxIdType'EnumJpRn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"kr_brn" -> TaxIdType'
TaxIdType'EnumKrBrn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"li_uid" -> TaxIdType'
TaxIdType'EnumLiUid
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"mx_rfc" -> TaxIdType'
TaxIdType'EnumMxRfc
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"my_frp" -> TaxIdType'
TaxIdType'EnumMyFrp
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"my_itn" -> TaxIdType'
TaxIdType'EnumMyItn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"my_sst" -> TaxIdType'
TaxIdType'EnumMySst
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"no_vat" -> TaxIdType'
TaxIdType'EnumNoVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"nz_gst" -> TaxIdType'
TaxIdType'EnumNzGst
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ru_inn" -> TaxIdType'
TaxIdType'EnumRuInn
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"ru_kpp" -> TaxIdType'
TaxIdType'EnumRuKpp
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sa_vat" -> TaxIdType'
TaxIdType'EnumSaVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sg_gst" -> TaxIdType'
TaxIdType'EnumSgGst
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sg_uen" -> TaxIdType'
TaxIdType'EnumSgUen
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"th_vat" -> TaxIdType'
TaxIdType'EnumThVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"tw_vat" -> TaxIdType'
TaxIdType'EnumTwVat
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"unknown" -> TaxIdType'
TaxIdType'EnumUnknown
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"us_ein" -> TaxIdType'
TaxIdType'EnumUsEin
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"za_vat" -> TaxIdType'
TaxIdType'EnumZaVat
            | Bool
GHC.Base.otherwise -> Value -> TaxIdType'
TaxIdType'Other Value
val
      )

-- | Defines the object schema located at @components.schemas.tax_id.properties.verification.anyOf@ in the specification.
--
-- Tax ID verification information.
data TaxIdVerification' = TaxIdVerification'
  { -- | status: Verification status, one of \`pending\`, \`verified\`, \`unverified\`, or \`unavailable\`.
    TaxIdVerification' -> Maybe TaxIdVerification'Status'
taxIdVerification'Status :: (GHC.Maybe.Maybe TaxIdVerification'Status'),
    -- | verified_address: Verified address.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    TaxIdVerification' -> Maybe Text
taxIdVerification'VerifiedAddress :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | verified_name: Verified name.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    TaxIdVerification' -> Maybe Text
taxIdVerification'VerifiedName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> TaxIdVerification' -> ShowS
[TaxIdVerification'] -> ShowS
TaxIdVerification' -> String
(Int -> TaxIdVerification' -> ShowS)
-> (TaxIdVerification' -> String)
-> ([TaxIdVerification'] -> ShowS)
-> Show TaxIdVerification'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaxIdVerification'] -> ShowS
$cshowList :: [TaxIdVerification'] -> ShowS
show :: TaxIdVerification' -> String
$cshow :: TaxIdVerification' -> String
showsPrec :: Int -> TaxIdVerification' -> ShowS
$cshowsPrec :: Int -> TaxIdVerification' -> ShowS
GHC.Show.Show,
      TaxIdVerification' -> TaxIdVerification' -> Bool
(TaxIdVerification' -> TaxIdVerification' -> Bool)
-> (TaxIdVerification' -> TaxIdVerification' -> Bool)
-> Eq TaxIdVerification'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaxIdVerification' -> TaxIdVerification' -> Bool
$c/= :: TaxIdVerification' -> TaxIdVerification' -> Bool
== :: TaxIdVerification' -> TaxIdVerification' -> Bool
$c== :: TaxIdVerification' -> TaxIdVerification' -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON TaxIdVerification' where
  toJSON :: TaxIdVerification' -> Value
toJSON TaxIdVerification'
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"status" Text -> Maybe TaxIdVerification'Status' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxIdVerification' -> Maybe TaxIdVerification'Status'
taxIdVerification'Status TaxIdVerification'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"verified_address" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxIdVerification' -> Maybe Text
taxIdVerification'VerifiedAddress TaxIdVerification'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"verified_name" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxIdVerification' -> Maybe Text
taxIdVerification'VerifiedName TaxIdVerification'
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: TaxIdVerification' -> Encoding
toEncoding TaxIdVerification'
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"status" Text -> Maybe TaxIdVerification'Status' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxIdVerification' -> Maybe TaxIdVerification'Status'
taxIdVerification'Status TaxIdVerification'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"verified_address" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxIdVerification' -> Maybe Text
taxIdVerification'VerifiedAddress TaxIdVerification'
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"verified_name" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= TaxIdVerification' -> Maybe Text
taxIdVerification'VerifiedName TaxIdVerification'
obj)))

instance Data.Aeson.Types.FromJSON.FromJSON TaxIdVerification' where
  parseJSON :: Value -> Parser TaxIdVerification'
parseJSON = String
-> (Object -> Parser TaxIdVerification')
-> Value
-> Parser TaxIdVerification'
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"TaxIdVerification'" (\Object
obj -> (((Maybe TaxIdVerification'Status'
 -> Maybe Text -> Maybe Text -> TaxIdVerification')
-> Parser
     (Maybe TaxIdVerification'Status'
      -> Maybe Text -> Maybe Text -> TaxIdVerification')
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe TaxIdVerification'Status'
-> Maybe Text -> Maybe Text -> TaxIdVerification'
TaxIdVerification' Parser
  (Maybe TaxIdVerification'Status'
   -> Maybe Text -> Maybe Text -> TaxIdVerification')
-> Parser (Maybe TaxIdVerification'Status')
-> Parser (Maybe Text -> Maybe Text -> TaxIdVerification')
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe TaxIdVerification'Status')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"status")) Parser (Maybe Text -> Maybe Text -> TaxIdVerification')
-> Parser (Maybe Text) -> Parser (Maybe Text -> TaxIdVerification')
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
"verified_address")) Parser (Maybe Text -> TaxIdVerification')
-> Parser (Maybe Text) -> Parser TaxIdVerification'
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
"verified_name"))

-- | Create a new 'TaxIdVerification'' with all required fields.
mkTaxIdVerification' :: TaxIdVerification'
mkTaxIdVerification' :: TaxIdVerification'
mkTaxIdVerification' =
  TaxIdVerification' :: Maybe TaxIdVerification'Status'
-> Maybe Text -> Maybe Text -> TaxIdVerification'
TaxIdVerification'
    { taxIdVerification'Status :: Maybe TaxIdVerification'Status'
taxIdVerification'Status = Maybe TaxIdVerification'Status'
forall a. Maybe a
GHC.Maybe.Nothing,
      taxIdVerification'VerifiedAddress :: Maybe Text
taxIdVerification'VerifiedAddress = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      taxIdVerification'VerifiedName :: Maybe Text
taxIdVerification'VerifiedName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.tax_id.properties.verification.anyOf.properties.status@ in the specification.
--
-- Verification status, one of \`pending\`, \`verified\`, \`unverified\`, or \`unavailable\`.
data TaxIdVerification'Status'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    TaxIdVerification'Status'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.
    TaxIdVerification'Status'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"pending"@
    TaxIdVerification'Status'EnumPending
  | -- | Represents the JSON value @"unavailable"@
    TaxIdVerification'Status'EnumUnavailable
  | -- | Represents the JSON value @"unverified"@
    TaxIdVerification'Status'EnumUnverified
  | -- | Represents the JSON value @"verified"@
    TaxIdVerification'Status'EnumVerified
  deriving (Int -> TaxIdVerification'Status' -> ShowS
[TaxIdVerification'Status'] -> ShowS
TaxIdVerification'Status' -> String
(Int -> TaxIdVerification'Status' -> ShowS)
-> (TaxIdVerification'Status' -> String)
-> ([TaxIdVerification'Status'] -> ShowS)
-> Show TaxIdVerification'Status'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaxIdVerification'Status'] -> ShowS
$cshowList :: [TaxIdVerification'Status'] -> ShowS
show :: TaxIdVerification'Status' -> String
$cshow :: TaxIdVerification'Status' -> String
showsPrec :: Int -> TaxIdVerification'Status' -> ShowS
$cshowsPrec :: Int -> TaxIdVerification'Status' -> ShowS
GHC.Show.Show, TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool
(TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool)
-> (TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool)
-> Eq TaxIdVerification'Status'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool
$c/= :: TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool
== :: TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool
$c== :: TaxIdVerification'Status' -> TaxIdVerification'Status' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON TaxIdVerification'Status' where
  toJSON :: TaxIdVerification'Status' -> Value
toJSON (TaxIdVerification'Status'Other Value
val) = Value
val
  toJSON (TaxIdVerification'Status'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (TaxIdVerification'Status'
TaxIdVerification'Status'EnumPending) = Value
"pending"
  toJSON (TaxIdVerification'Status'
TaxIdVerification'Status'EnumUnavailable) = Value
"unavailable"
  toJSON (TaxIdVerification'Status'
TaxIdVerification'Status'EnumUnverified) = Value
"unverified"
  toJSON (TaxIdVerification'Status'
TaxIdVerification'Status'EnumVerified) = Value
"verified"

instance Data.Aeson.Types.FromJSON.FromJSON TaxIdVerification'Status' where
  parseJSON :: Value -> Parser TaxIdVerification'Status'
parseJSON Value
val =
    TaxIdVerification'Status' -> Parser TaxIdVerification'Status'
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
"pending" -> TaxIdVerification'Status'
TaxIdVerification'Status'EnumPending
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"unavailable" -> TaxIdVerification'Status'
TaxIdVerification'Status'EnumUnavailable
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"unverified" -> TaxIdVerification'Status'
TaxIdVerification'Status'EnumUnverified
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"verified" -> TaxIdVerification'Status'
TaxIdVerification'Status'EnumVerified
            | Bool
GHC.Base.otherwise -> Value -> TaxIdVerification'Status'
TaxIdVerification'Status'Other Value
val
      )