{-# 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 BusinessEntity
module RecurlyClient.Types.BusinessEntity 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
import qualified Data.ByteString 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 as 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 RecurlyClient.Common
import RecurlyClient.TypeAlias
import {-# SOURCE #-} RecurlyClient.Types.Address
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

{- | Defines the object schema located at @components.schemas.BusinessEntity@ in the specification.

Business entity details
-}
data BusinessEntity = BusinessEntity
    { BusinessEntity -> Maybe Text
businessEntityCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ code: The entity code of the business entity.
    --
    -- Constraints:
    --
    -- * Maximum length of 50
    , BusinessEntity -> Maybe JsonDateTime
businessEntityCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at
    , BusinessEntity -> Maybe Text
businessEntityDefault_liability_gl_account_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ default_liability_gl_account_id: The ID of a general ledger account. General ledger accounts are
    -- only accessible as a part of the Recurly RevRec Standard and
    -- Recurly RevRec Advanced features.
    --
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , BusinessEntity -> Maybe Text
businessEntityDefault_registration_number :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ default_registration_number: Registration number for the customer used on the invoice.
    --
    -- Constraints:
    --
    -- * Maximum length of 30
    , BusinessEntity -> Maybe Text
businessEntityDefault_revenue_gl_account_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ default_revenue_gl_account_id: The ID of a general ledger account. General ledger accounts are
    -- only accessible as a part of the Recurly RevRec Standard and
    -- Recurly RevRec Advanced features.
    --
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , BusinessEntity -> Maybe Text
businessEntityDefault_vat_number :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ default_vat_number: VAT number for the customer used on the invoice.
    --
    -- Constraints:
    --
    -- * Maximum length of 20
    , BusinessEntity
-> Maybe BusinessEntityDestination_tax_address_source
businessEntityDestination_tax_address_source :: (GHC.Maybe.Maybe BusinessEntityDestination_tax_address_source)
    -- ^ destination_tax_address_source: The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of \"destination\" refers to the \"Customer tax address\". A value of \"origin\" refers to the \"Business entity tax address\".
    , BusinessEntity -> Maybe Text
businessEntityId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , BusinessEntity -> Maybe Address
businessEntityInvoice_display_address :: (GHC.Maybe.Maybe Address)
    -- ^ invoice_display_address
    , BusinessEntity -> Maybe Text
businessEntityName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ name: This name describes your business entity and will appear on the invoice.
    --
    -- Constraints:
    --
    -- * Maximum length of 255
    , BusinessEntity -> Maybe Text
businessEntityObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , BusinessEntity -> Maybe BusinessEntityOrigin_tax_address_source
businessEntityOrigin_tax_address_source :: (GHC.Maybe.Maybe BusinessEntityOrigin_tax_address_source)
    -- ^ origin_tax_address_source: The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of \"origin\" refers to the \"Business entity tax address\". A value of \"destination\" refers to the \"Customer tax address\".
    , BusinessEntity -> Maybe [Text]
businessEntitySubscriber_location_countries :: (GHC.Maybe.Maybe [Data.Text.Internal.Text])
    -- ^ subscriber_location_countries: List of countries for which the business entity will be used.
    , BusinessEntity -> Maybe Address
businessEntityTax_address :: (GHC.Maybe.Maybe Address)
    -- ^ tax_address
    , BusinessEntity -> Maybe JsonDateTime
businessEntityUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at
    }
    deriving
        ( Int -> BusinessEntity -> ShowS
[BusinessEntity] -> ShowS
BusinessEntity -> String
(Int -> BusinessEntity -> ShowS)
-> (BusinessEntity -> String)
-> ([BusinessEntity] -> ShowS)
-> Show BusinessEntity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BusinessEntity -> ShowS
showsPrec :: Int -> BusinessEntity -> ShowS
$cshow :: BusinessEntity -> String
show :: BusinessEntity -> String
$cshowList :: [BusinessEntity] -> ShowS
showList :: [BusinessEntity] -> ShowS
GHC.Show.Show
        , BusinessEntity -> BusinessEntity -> Bool
(BusinessEntity -> BusinessEntity -> Bool)
-> (BusinessEntity -> BusinessEntity -> Bool) -> Eq BusinessEntity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BusinessEntity -> BusinessEntity -> Bool
== :: BusinessEntity -> BusinessEntity -> Bool
$c/= :: BusinessEntity -> BusinessEntity -> Bool
/= :: BusinessEntity -> BusinessEntity -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON BusinessEntity where
    toJSON :: BusinessEntity -> Value
toJSON BusinessEntity
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityCode BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe JsonDateTime
businessEntityCreated_at BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_liability_gl_account_id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_liability_gl_account_id BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_registration_number" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_registration_number BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_revenue_gl_account_id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_revenue_gl_account_id BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_vat_number" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_vat_number BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (BusinessEntityDestination_tax_address_source -> [Pair])
-> Maybe BusinessEntityDestination_tax_address_source
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (BusinessEntityDestination_tax_address_source -> Pair)
-> BusinessEntityDestination_tax_address_source
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"destination_tax_address_source" Key -> BusinessEntityDestination_tax_address_source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity
-> Maybe BusinessEntityDestination_tax_address_source
businessEntityDestination_tax_address_source BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityId BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Address -> [Pair]) -> Maybe Address -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Address -> Pair) -> Address -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"invoice_display_address" Key -> Address -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Address
businessEntityInvoice_display_address BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityName BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityObject BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (BusinessEntityOrigin_tax_address_source -> [Pair])
-> Maybe BusinessEntityOrigin_tax_address_source
-> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (BusinessEntityOrigin_tax_address_source -> Pair)
-> BusinessEntityOrigin_tax_address_source
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"origin_tax_address_source" Key -> BusinessEntityOrigin_tax_address_source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe BusinessEntityOrigin_tax_address_source
businessEntityOrigin_tax_address_source BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> ([Text] -> [Pair]) -> Maybe [Text] -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> ([Text] -> Pair) -> [Text] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"subscriber_location_countries" Key -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe [Text]
businessEntitySubscriber_location_countries BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Address -> [Pair]) -> Maybe Address -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Address -> Pair) -> Address -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"tax_address" Key -> Address -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Address
businessEntityTax_address BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe JsonDateTime
businessEntityUpdated_at BusinessEntity
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: BusinessEntity -> Encoding
toEncoding BusinessEntity
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityCode BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe JsonDateTime
businessEntityCreated_at BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_liability_gl_account_id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_liability_gl_account_id BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_registration_number" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_registration_number BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_revenue_gl_account_id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_revenue_gl_account_id BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"default_vat_number" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityDefault_vat_number BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (BusinessEntityDestination_tax_address_source -> [Series])
-> Maybe BusinessEntityDestination_tax_address_source
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (BusinessEntityDestination_tax_address_source -> Series)
-> BusinessEntityDestination_tax_address_source
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"destination_tax_address_source" Key -> BusinessEntityDestination_tax_address_source -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity
-> Maybe BusinessEntityDestination_tax_address_source
businessEntityDestination_tax_address_source BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityId BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Address -> [Series]) -> Maybe Address -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Address -> Series) -> Address -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"invoice_display_address" Key -> Address -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Address
businessEntityInvoice_display_address BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityName BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Text
businessEntityObject BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (BusinessEntityOrigin_tax_address_source -> [Series])
-> Maybe BusinessEntityOrigin_tax_address_source
-> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (BusinessEntityOrigin_tax_address_source -> Series)
-> BusinessEntityOrigin_tax_address_source
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"origin_tax_address_source" Key -> BusinessEntityOrigin_tax_address_source -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe BusinessEntityOrigin_tax_address_source
businessEntityOrigin_tax_address_source BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> ([Text] -> [Series]) -> Maybe [Text] -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> ([Text] -> Series) -> [Text] -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"subscriber_location_countries" Key -> [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe [Text]
businessEntitySubscriber_location_countries BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Address -> [Series]) -> Maybe Address -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Address -> Series) -> Address -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"tax_address" Key -> Address -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe Address
businessEntityTax_address BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (BusinessEntity -> Maybe JsonDateTime
businessEntityUpdated_at BusinessEntity
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON BusinessEntity where
    parseJSON :: Value -> Parser BusinessEntity
parseJSON = String
-> (Object -> Parser BusinessEntity)
-> Value
-> Parser BusinessEntity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"BusinessEntity" (\Object
obj -> (((((((((((((((Maybe Text
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe BusinessEntityDestination_tax_address_source
 -> Maybe Text
 -> Maybe Address
 -> Maybe Text
 -> Maybe Text
 -> Maybe BusinessEntityOrigin_tax_address_source
 -> Maybe [Text]
 -> Maybe Address
 -> Maybe JsonDateTime
 -> BusinessEntity)
-> Parser
     (Maybe Text
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe BusinessEntityDestination_tax_address_source
-> Maybe Text
-> Maybe Address
-> Maybe Text
-> Maybe Text
-> Maybe BusinessEntityOrigin_tax_address_source
-> Maybe [Text]
-> Maybe Address
-> Maybe JsonDateTime
-> BusinessEntity
BusinessEntity Parser
  (Maybe Text
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"code")) Parser
  (Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"default_liability_gl_account_id")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"default_registration_number")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"default_revenue_gl_account_id")) Parser
  (Maybe Text
   -> Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe BusinessEntityDestination_tax_address_source
      -> Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"default_vat_number")) Parser
  (Maybe BusinessEntityDestination_tax_address_source
   -> Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe BusinessEntityDestination_tax_address_source)
-> Parser
     (Maybe Text
      -> Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Key
-> Parser (Maybe BusinessEntityDestination_tax_address_source)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"destination_tax_address_source")) Parser
  (Maybe Text
   -> Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Address
      -> Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
  (Maybe Address
   -> Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Address)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Address)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"invoice_display_address")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"name")) Parser
  (Maybe Text
   -> Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe BusinessEntityOrigin_tax_address_source
      -> Maybe [Text]
      -> Maybe Address
      -> Maybe JsonDateTime
      -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser
  (Maybe BusinessEntityOrigin_tax_address_source
   -> Maybe [Text]
   -> Maybe Address
   -> Maybe JsonDateTime
   -> BusinessEntity)
-> Parser (Maybe BusinessEntityOrigin_tax_address_source)
-> Parser
     (Maybe [Text]
      -> Maybe Address -> Maybe JsonDateTime -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Key -> Parser (Maybe BusinessEntityOrigin_tax_address_source)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"origin_tax_address_source")) Parser
  (Maybe [Text]
   -> Maybe Address -> Maybe JsonDateTime -> BusinessEntity)
-> Parser (Maybe [Text])
-> Parser (Maybe Address -> Maybe JsonDateTime -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"subscriber_location_countries")) Parser (Maybe Address -> Maybe JsonDateTime -> BusinessEntity)
-> Parser (Maybe Address)
-> Parser (Maybe JsonDateTime -> BusinessEntity)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Address)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"tax_address")) Parser (Maybe JsonDateTime -> BusinessEntity)
-> Parser (Maybe JsonDateTime) -> Parser BusinessEntity
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at"))

-- | Create a new 'BusinessEntity' with all required fields.
mkBusinessEntity :: BusinessEntity
mkBusinessEntity :: BusinessEntity
mkBusinessEntity =
    BusinessEntity
        { businessEntityCode :: Maybe Text
businessEntityCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityCreated_at :: Maybe JsonDateTime
businessEntityCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityDefault_liability_gl_account_id :: Maybe Text
businessEntityDefault_liability_gl_account_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityDefault_registration_number :: Maybe Text
businessEntityDefault_registration_number = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityDefault_revenue_gl_account_id :: Maybe Text
businessEntityDefault_revenue_gl_account_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityDefault_vat_number :: Maybe Text
businessEntityDefault_vat_number = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityDestination_tax_address_source :: Maybe BusinessEntityDestination_tax_address_source
businessEntityDestination_tax_address_source = Maybe BusinessEntityDestination_tax_address_source
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityId :: Maybe Text
businessEntityId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityInvoice_display_address :: Maybe Address
businessEntityInvoice_display_address = Maybe Address
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityName :: Maybe Text
businessEntityName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityObject :: Maybe Text
businessEntityObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityOrigin_tax_address_source :: Maybe BusinessEntityOrigin_tax_address_source
businessEntityOrigin_tax_address_source = Maybe BusinessEntityOrigin_tax_address_source
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntitySubscriber_location_countries :: Maybe [Text]
businessEntitySubscriber_location_countries = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityTax_address :: Maybe Address
businessEntityTax_address = Maybe Address
forall a. Maybe a
GHC.Maybe.Nothing
        , businessEntityUpdated_at :: Maybe JsonDateTime
businessEntityUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        }

{- | Defines the enum schema located at @components.schemas.BusinessEntity.properties.destination_tax_address_source@ in the specification.

The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of \"destination\" refers to the \"Customer tax address\". A value of \"origin\" refers to the \"Business entity tax address\".
-}
data BusinessEntityDestination_tax_address_source
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      BusinessEntityDestination_tax_address_sourceOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      BusinessEntityDestination_tax_address_sourceTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"destination"@
      BusinessEntityDestination_tax_address_sourceEnumDestination
    | -- | Represents the JSON value @"origin"@
      BusinessEntityDestination_tax_address_sourceEnumOrigin
    deriving (Int -> BusinessEntityDestination_tax_address_source -> ShowS
[BusinessEntityDestination_tax_address_source] -> ShowS
BusinessEntityDestination_tax_address_source -> String
(Int -> BusinessEntityDestination_tax_address_source -> ShowS)
-> (BusinessEntityDestination_tax_address_source -> String)
-> ([BusinessEntityDestination_tax_address_source] -> ShowS)
-> Show BusinessEntityDestination_tax_address_source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BusinessEntityDestination_tax_address_source -> ShowS
showsPrec :: Int -> BusinessEntityDestination_tax_address_source -> ShowS
$cshow :: BusinessEntityDestination_tax_address_source -> String
show :: BusinessEntityDestination_tax_address_source -> String
$cshowList :: [BusinessEntityDestination_tax_address_source] -> ShowS
showList :: [BusinessEntityDestination_tax_address_source] -> ShowS
GHC.Show.Show, BusinessEntityDestination_tax_address_source
-> BusinessEntityDestination_tax_address_source -> Bool
(BusinessEntityDestination_tax_address_source
 -> BusinessEntityDestination_tax_address_source -> Bool)
-> (BusinessEntityDestination_tax_address_source
    -> BusinessEntityDestination_tax_address_source -> Bool)
-> Eq BusinessEntityDestination_tax_address_source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BusinessEntityDestination_tax_address_source
-> BusinessEntityDestination_tax_address_source -> Bool
== :: BusinessEntityDestination_tax_address_source
-> BusinessEntityDestination_tax_address_source -> Bool
$c/= :: BusinessEntityDestination_tax_address_source
-> BusinessEntityDestination_tax_address_source -> Bool
/= :: BusinessEntityDestination_tax_address_source
-> BusinessEntityDestination_tax_address_source -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BusinessEntityDestination_tax_address_source where
    toJSON :: BusinessEntityDestination_tax_address_source -> Value
toJSON (BusinessEntityDestination_tax_address_sourceOther Value
val) = Value
val
    toJSON (BusinessEntityDestination_tax_address_sourceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (BusinessEntityDestination_tax_address_source
BusinessEntityDestination_tax_address_sourceEnumDestination) = Value
"destination"
    toJSON (BusinessEntityDestination_tax_address_source
BusinessEntityDestination_tax_address_sourceEnumOrigin) = Value
"origin"
instance Data.Aeson.Types.FromJSON.FromJSON BusinessEntityDestination_tax_address_source where
    parseJSON :: Value -> Parser BusinessEntityDestination_tax_address_source
parseJSON Value
val =
        BusinessEntityDestination_tax_address_source
-> Parser BusinessEntityDestination_tax_address_source
forall a. a -> Parser a
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
"destination" -> BusinessEntityDestination_tax_address_source
BusinessEntityDestination_tax_address_sourceEnumDestination
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"origin" -> BusinessEntityDestination_tax_address_source
BusinessEntityDestination_tax_address_sourceEnumOrigin
                | Bool
GHC.Base.otherwise -> Value -> BusinessEntityDestination_tax_address_source
BusinessEntityDestination_tax_address_sourceOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.BusinessEntity.properties.origin_tax_address_source@ in the specification.

The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of \"origin\" refers to the \"Business entity tax address\". A value of \"destination\" refers to the \"Customer tax address\".
-}
data BusinessEntityOrigin_tax_address_source
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      BusinessEntityOrigin_tax_address_sourceOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      BusinessEntityOrigin_tax_address_sourceTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"origin"@
      BusinessEntityOrigin_tax_address_sourceEnumOrigin
    | -- | Represents the JSON value @"destination"@
      BusinessEntityOrigin_tax_address_sourceEnumDestination
    deriving (Int -> BusinessEntityOrigin_tax_address_source -> ShowS
[BusinessEntityOrigin_tax_address_source] -> ShowS
BusinessEntityOrigin_tax_address_source -> String
(Int -> BusinessEntityOrigin_tax_address_source -> ShowS)
-> (BusinessEntityOrigin_tax_address_source -> String)
-> ([BusinessEntityOrigin_tax_address_source] -> ShowS)
-> Show BusinessEntityOrigin_tax_address_source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BusinessEntityOrigin_tax_address_source -> ShowS
showsPrec :: Int -> BusinessEntityOrigin_tax_address_source -> ShowS
$cshow :: BusinessEntityOrigin_tax_address_source -> String
show :: BusinessEntityOrigin_tax_address_source -> String
$cshowList :: [BusinessEntityOrigin_tax_address_source] -> ShowS
showList :: [BusinessEntityOrigin_tax_address_source] -> ShowS
GHC.Show.Show, BusinessEntityOrigin_tax_address_source
-> BusinessEntityOrigin_tax_address_source -> Bool
(BusinessEntityOrigin_tax_address_source
 -> BusinessEntityOrigin_tax_address_source -> Bool)
-> (BusinessEntityOrigin_tax_address_source
    -> BusinessEntityOrigin_tax_address_source -> Bool)
-> Eq BusinessEntityOrigin_tax_address_source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BusinessEntityOrigin_tax_address_source
-> BusinessEntityOrigin_tax_address_source -> Bool
== :: BusinessEntityOrigin_tax_address_source
-> BusinessEntityOrigin_tax_address_source -> Bool
$c/= :: BusinessEntityOrigin_tax_address_source
-> BusinessEntityOrigin_tax_address_source -> Bool
/= :: BusinessEntityOrigin_tax_address_source
-> BusinessEntityOrigin_tax_address_source -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON BusinessEntityOrigin_tax_address_source where
    toJSON :: BusinessEntityOrigin_tax_address_source -> Value
toJSON (BusinessEntityOrigin_tax_address_sourceOther Value
val) = Value
val
    toJSON (BusinessEntityOrigin_tax_address_sourceTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (BusinessEntityOrigin_tax_address_source
BusinessEntityOrigin_tax_address_sourceEnumOrigin) = Value
"origin"
    toJSON (BusinessEntityOrigin_tax_address_source
BusinessEntityOrigin_tax_address_sourceEnumDestination) = Value
"destination"
instance Data.Aeson.Types.FromJSON.FromJSON BusinessEntityOrigin_tax_address_source where
    parseJSON :: Value -> Parser BusinessEntityOrigin_tax_address_source
parseJSON Value
val =
        BusinessEntityOrigin_tax_address_source
-> Parser BusinessEntityOrigin_tax_address_source
forall a. a -> Parser a
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
"origin" -> BusinessEntityOrigin_tax_address_source
BusinessEntityOrigin_tax_address_sourceEnumOrigin
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"destination" -> BusinessEntityOrigin_tax_address_source
BusinessEntityOrigin_tax_address_sourceEnumDestination
                | Bool
GHC.Base.otherwise -> Value -> BusinessEntityOrigin_tax_address_source
BusinessEntityOrigin_tax_address_sourceOther Value
val
            )