{-# 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 CountrySpecVerificationFields
module StripeAPI.Types.CountrySpecVerificationFields 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.CountrySpecVerificationFieldDetails
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.country_spec_verification_fields@ in the specification.
data CountrySpecVerificationFields = CountrySpecVerificationFields
  { -- | company:
    CountrySpecVerificationFields
-> CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsCompany :: CountrySpecVerificationFieldDetails,
    -- | individual:
    CountrySpecVerificationFields
-> CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsIndividual :: CountrySpecVerificationFieldDetails
  }
  deriving
    ( Int -> CountrySpecVerificationFields -> ShowS
[CountrySpecVerificationFields] -> ShowS
CountrySpecVerificationFields -> String
(Int -> CountrySpecVerificationFields -> ShowS)
-> (CountrySpecVerificationFields -> String)
-> ([CountrySpecVerificationFields] -> ShowS)
-> Show CountrySpecVerificationFields
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CountrySpecVerificationFields] -> ShowS
$cshowList :: [CountrySpecVerificationFields] -> ShowS
show :: CountrySpecVerificationFields -> String
$cshow :: CountrySpecVerificationFields -> String
showsPrec :: Int -> CountrySpecVerificationFields -> ShowS
$cshowsPrec :: Int -> CountrySpecVerificationFields -> ShowS
GHC.Show.Show,
      CountrySpecVerificationFields
-> CountrySpecVerificationFields -> Bool
(CountrySpecVerificationFields
 -> CountrySpecVerificationFields -> Bool)
-> (CountrySpecVerificationFields
    -> CountrySpecVerificationFields -> Bool)
-> Eq CountrySpecVerificationFields
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CountrySpecVerificationFields
-> CountrySpecVerificationFields -> Bool
$c/= :: CountrySpecVerificationFields
-> CountrySpecVerificationFields -> Bool
== :: CountrySpecVerificationFields
-> CountrySpecVerificationFields -> Bool
$c== :: CountrySpecVerificationFields
-> CountrySpecVerificationFields -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON CountrySpecVerificationFields where
  toJSON :: CountrySpecVerificationFields -> Value
toJSON CountrySpecVerificationFields
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"company" Text -> CountrySpecVerificationFieldDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CountrySpecVerificationFields
-> CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsCompany CountrySpecVerificationFields
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"individual" Text -> CountrySpecVerificationFieldDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CountrySpecVerificationFields
-> CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsIndividual CountrySpecVerificationFields
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: CountrySpecVerificationFields -> Encoding
toEncoding CountrySpecVerificationFields
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"company" Text -> CountrySpecVerificationFieldDetails -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CountrySpecVerificationFields
-> CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsCompany CountrySpecVerificationFields
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"individual" Text -> CountrySpecVerificationFieldDetails -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= CountrySpecVerificationFields
-> CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsIndividual CountrySpecVerificationFields
obj))

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

-- | Create a new 'CountrySpecVerificationFields' with all required fields.
mkCountrySpecVerificationFields ::
  -- | 'countrySpecVerificationFieldsCompany'
  CountrySpecVerificationFieldDetails ->
  -- | 'countrySpecVerificationFieldsIndividual'
  CountrySpecVerificationFieldDetails ->
  CountrySpecVerificationFields
mkCountrySpecVerificationFields :: CountrySpecVerificationFieldDetails
-> CountrySpecVerificationFieldDetails
-> CountrySpecVerificationFields
mkCountrySpecVerificationFields CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsCompany CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsIndividual =
  CountrySpecVerificationFields :: CountrySpecVerificationFieldDetails
-> CountrySpecVerificationFieldDetails
-> CountrySpecVerificationFields
CountrySpecVerificationFields
    { countrySpecVerificationFieldsCompany :: CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsCompany = CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsCompany,
      countrySpecVerificationFieldsIndividual :: CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsIndividual = CountrySpecVerificationFieldDetails
countrySpecVerificationFieldsIndividual
    }