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

-- | Defines the object schema located at @components.schemas.portal_invoice_list@ in the specification.
data PortalInvoiceList = PortalInvoiceList
  { -- | enabled: Whether the feature is enabled.
    PortalInvoiceList -> Bool
portalInvoiceListEnabled :: GHC.Types.Bool
  }
  deriving
    ( Int -> PortalInvoiceList -> ShowS
[PortalInvoiceList] -> ShowS
PortalInvoiceList -> String
(Int -> PortalInvoiceList -> ShowS)
-> (PortalInvoiceList -> String)
-> ([PortalInvoiceList] -> ShowS)
-> Show PortalInvoiceList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortalInvoiceList] -> ShowS
$cshowList :: [PortalInvoiceList] -> ShowS
show :: PortalInvoiceList -> String
$cshow :: PortalInvoiceList -> String
showsPrec :: Int -> PortalInvoiceList -> ShowS
$cshowsPrec :: Int -> PortalInvoiceList -> ShowS
GHC.Show.Show,
      PortalInvoiceList -> PortalInvoiceList -> Bool
(PortalInvoiceList -> PortalInvoiceList -> Bool)
-> (PortalInvoiceList -> PortalInvoiceList -> Bool)
-> Eq PortalInvoiceList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortalInvoiceList -> PortalInvoiceList -> Bool
$c/= :: PortalInvoiceList -> PortalInvoiceList -> Bool
== :: PortalInvoiceList -> PortalInvoiceList -> Bool
$c== :: PortalInvoiceList -> PortalInvoiceList -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON PortalInvoiceList where
  toJSON :: PortalInvoiceList -> Value
toJSON PortalInvoiceList
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalInvoiceList -> Bool
portalInvoiceListEnabled PortalInvoiceList
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: PortalInvoiceList -> Encoding
toEncoding PortalInvoiceList
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs (Text
"enabled" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PortalInvoiceList -> Bool
portalInvoiceListEnabled PortalInvoiceList
obj)

instance Data.Aeson.Types.FromJSON.FromJSON PortalInvoiceList where
  parseJSON :: Value -> Parser PortalInvoiceList
parseJSON = String
-> (Object -> Parser PortalInvoiceList)
-> Value
-> Parser PortalInvoiceList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PortalInvoiceList" (\Object
obj -> (Bool -> PortalInvoiceList) -> Parser (Bool -> PortalInvoiceList)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Bool -> PortalInvoiceList
PortalInvoiceList Parser (Bool -> PortalInvoiceList)
-> Parser Bool -> Parser PortalInvoiceList
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
"enabled"))

-- | Create a new 'PortalInvoiceList' with all required fields.
mkPortalInvoiceList ::
  -- | 'portalInvoiceListEnabled'
  GHC.Types.Bool ->
  PortalInvoiceList
mkPortalInvoiceList :: Bool -> PortalInvoiceList
mkPortalInvoiceList Bool
portalInvoiceListEnabled = PortalInvoiceList :: Bool -> PortalInvoiceList
PortalInvoiceList {portalInvoiceListEnabled :: Bool
portalInvoiceListEnabled = Bool
portalInvoiceListEnabled}