{-# 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 InvoiceTaxAmount module StripeAPI.Types.InvoiceTaxAmount 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.TaxRate import qualified Prelude as GHC.Integer.Type import qualified Prelude as GHC.Maybe -- | Defines the object schema located at @components.schemas.invoice_tax_amount@ in the specification. data InvoiceTaxAmount = InvoiceTaxAmount { -- | amount: The amount, in %s, of the tax. invoiceTaxAmountAmount :: GHC.Types.Int, -- | inclusive: Whether this tax amount is inclusive or exclusive. invoiceTaxAmountInclusive :: GHC.Types.Bool, -- | tax_rate: The tax rate that was applied to get this tax amount. invoiceTaxAmountTaxRate :: InvoiceTaxAmountTaxRate'Variants } deriving ( GHC.Show.Show, GHC.Classes.Eq ) instance Data.Aeson.Types.ToJSON.ToJSON InvoiceTaxAmount where toJSON obj = Data.Aeson.Types.Internal.object ("amount" Data.Aeson.Types.ToJSON..= invoiceTaxAmountAmount obj : "inclusive" Data.Aeson.Types.ToJSON..= invoiceTaxAmountInclusive obj : "tax_rate" Data.Aeson.Types.ToJSON..= invoiceTaxAmountTaxRate obj : GHC.Base.mempty) toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("amount" Data.Aeson.Types.ToJSON..= invoiceTaxAmountAmount obj) GHC.Base.<> (("inclusive" Data.Aeson.Types.ToJSON..= invoiceTaxAmountInclusive obj) GHC.Base.<> ("tax_rate" Data.Aeson.Types.ToJSON..= invoiceTaxAmountTaxRate obj))) instance Data.Aeson.Types.FromJSON.FromJSON InvoiceTaxAmount where parseJSON = Data.Aeson.Types.FromJSON.withObject "InvoiceTaxAmount" (\obj -> ((GHC.Base.pure InvoiceTaxAmount GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "amount")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "inclusive")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "tax_rate")) -- | Create a new 'InvoiceTaxAmount' with all required fields. mkInvoiceTaxAmount :: -- | 'invoiceTaxAmountAmount' GHC.Types.Int -> -- | 'invoiceTaxAmountInclusive' GHC.Types.Bool -> -- | 'invoiceTaxAmountTaxRate' InvoiceTaxAmountTaxRate'Variants -> InvoiceTaxAmount mkInvoiceTaxAmount invoiceTaxAmountAmount invoiceTaxAmountInclusive invoiceTaxAmountTaxRate = InvoiceTaxAmount { invoiceTaxAmountAmount = invoiceTaxAmountAmount, invoiceTaxAmountInclusive = invoiceTaxAmountInclusive, invoiceTaxAmountTaxRate = invoiceTaxAmountTaxRate } -- | Defines the oneOf schema located at @components.schemas.invoice_tax_amount.properties.tax_rate.anyOf@ in the specification. -- -- The tax rate that was applied to get this tax amount. data InvoiceTaxAmountTaxRate'Variants = InvoiceTaxAmountTaxRate'Text Data.Text.Internal.Text | InvoiceTaxAmountTaxRate'TaxRate TaxRate deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON InvoiceTaxAmountTaxRate'Variants where toJSON (InvoiceTaxAmountTaxRate'Text a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (InvoiceTaxAmountTaxRate'TaxRate a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON InvoiceTaxAmountTaxRate'Variants where parseJSON val = case (InvoiceTaxAmountTaxRate'Text Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((InvoiceTaxAmountTaxRate'TaxRate Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched") of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a