{-# 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 TaxIdVerification module StripeAPI.Types.TaxIdVerification 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.Foldable import qualified Data.Functor import qualified Data.Maybe 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.tax_id_verification@ in the specification. data TaxIdVerification = TaxIdVerification { -- | status: Verification status, one of \`pending\`, \`verified\`, \`unverified\`, or \`unavailable\`. taxIdVerificationStatus :: TaxIdVerificationStatus', -- | verified_address: Verified address. -- -- Constraints: -- -- * Maximum length of 5000 taxIdVerificationVerifiedAddress :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)), -- | verified_name: Verified name. -- -- Constraints: -- -- * Maximum length of 5000 taxIdVerificationVerifiedName :: (GHC.Maybe.Maybe (StripeAPI.Common.Nullable Data.Text.Internal.Text)) } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON TaxIdVerification where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["status" Data.Aeson.Types.ToJSON..= taxIdVerificationStatus obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("verified_address" Data.Aeson.Types.ToJSON..=)) (taxIdVerificationVerifiedAddress obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("verified_name" Data.Aeson.Types.ToJSON..=)) (taxIdVerificationVerifiedName obj) : GHC.Base.mempty)) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["status" Data.Aeson.Types.ToJSON..= taxIdVerificationStatus obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("verified_address" Data.Aeson.Types.ToJSON..=)) (taxIdVerificationVerifiedAddress obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("verified_name" Data.Aeson.Types.ToJSON..=)) (taxIdVerificationVerifiedName obj) : GHC.Base.mempty))) instance Data.Aeson.Types.FromJSON.FromJSON TaxIdVerification where parseJSON = Data.Aeson.Types.FromJSON.withObject "TaxIdVerification" (\obj -> ((GHC.Base.pure TaxIdVerification GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "status")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "verified_address")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "verified_name")) -- | Create a new 'TaxIdVerification' with all required fields. mkTaxIdVerification :: -- | 'taxIdVerificationStatus' TaxIdVerificationStatus' -> TaxIdVerification mkTaxIdVerification taxIdVerificationStatus = TaxIdVerification { taxIdVerificationStatus = taxIdVerificationStatus, taxIdVerificationVerifiedAddress = GHC.Maybe.Nothing, taxIdVerificationVerifiedName = GHC.Maybe.Nothing } -- | Defines the enum schema located at @components.schemas.tax_id_verification.properties.status@ in the specification. -- -- Verification status, one of \`pending\`, \`verified\`, \`unverified\`, or \`unavailable\`. data TaxIdVerificationStatus' = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification. TaxIdVerificationStatus'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. TaxIdVerificationStatus'Typed Data.Text.Internal.Text | -- | Represents the JSON value @"pending"@ TaxIdVerificationStatus'EnumPending | -- | Represents the JSON value @"unavailable"@ TaxIdVerificationStatus'EnumUnavailable | -- | Represents the JSON value @"unverified"@ TaxIdVerificationStatus'EnumUnverified | -- | Represents the JSON value @"verified"@ TaxIdVerificationStatus'EnumVerified deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON TaxIdVerificationStatus' where toJSON (TaxIdVerificationStatus'Other val) = val toJSON (TaxIdVerificationStatus'Typed val) = Data.Aeson.Types.ToJSON.toJSON val toJSON (TaxIdVerificationStatus'EnumPending) = "pending" toJSON (TaxIdVerificationStatus'EnumUnavailable) = "unavailable" toJSON (TaxIdVerificationStatus'EnumUnverified) = "unverified" toJSON (TaxIdVerificationStatus'EnumVerified) = "verified" instance Data.Aeson.Types.FromJSON.FromJSON TaxIdVerificationStatus' where parseJSON val = GHC.Base.pure ( if | val GHC.Classes.== "pending" -> TaxIdVerificationStatus'EnumPending | val GHC.Classes.== "unavailable" -> TaxIdVerificationStatus'EnumUnavailable | val GHC.Classes.== "unverified" -> TaxIdVerificationStatus'EnumUnverified | val GHC.Classes.== "verified" -> TaxIdVerificationStatus'EnumVerified | GHC.Base.otherwise -> TaxIdVerificationStatus'Other val )