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

-- | Defines the object schema located at @components.schemas.InvoiceMini@ in the specification.
data InvoiceMini = InvoiceMini
    { InvoiceMini -> Maybe Text
invoiceMiniBusiness_entity_id :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ business_entity_id: Unique ID to identify the business entity assigned to the invoice. Available when the \`Multiple Business Entities\` feature is enabled.
    , InvoiceMini -> Maybe Text
invoiceMiniId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , InvoiceMini -> Maybe Text
invoiceMiniNumber :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ number
    , InvoiceMini -> Maybe Text
invoiceMiniObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , InvoiceMini -> Maybe InvoiceMiniState
invoiceMiniState :: (GHC.Maybe.Maybe InvoiceMiniState)
    -- ^ state
    , InvoiceMini -> Maybe InvoiceMiniType
invoiceMiniType :: (GHC.Maybe.Maybe InvoiceMiniType)
    -- ^ type
    }
    deriving
        ( Int -> InvoiceMini -> ShowS
[InvoiceMini] -> ShowS
InvoiceMini -> String
(Int -> InvoiceMini -> ShowS)
-> (InvoiceMini -> String)
-> ([InvoiceMini] -> ShowS)
-> Show InvoiceMini
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvoiceMini -> ShowS
showsPrec :: Int -> InvoiceMini -> ShowS
$cshow :: InvoiceMini -> String
show :: InvoiceMini -> String
$cshowList :: [InvoiceMini] -> ShowS
showList :: [InvoiceMini] -> ShowS
GHC.Show.Show
        , InvoiceMini -> InvoiceMini -> Bool
(InvoiceMini -> InvoiceMini -> Bool)
-> (InvoiceMini -> InvoiceMini -> Bool) -> Eq InvoiceMini
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InvoiceMini -> InvoiceMini -> Bool
== :: InvoiceMini -> InvoiceMini -> Bool
$c/= :: InvoiceMini -> InvoiceMini -> Bool
/= :: InvoiceMini -> InvoiceMini -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceMini where
    toJSON :: InvoiceMini -> Value
toJSON InvoiceMini
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
"business_entity_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..=)) (InvoiceMini -> Maybe Text
invoiceMiniBusiness_entity_id InvoiceMini
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..=)) (InvoiceMini -> Maybe Text
invoiceMiniId InvoiceMini
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
"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..=)) (InvoiceMini -> Maybe Text
invoiceMiniNumber InvoiceMini
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..=)) (InvoiceMini -> Maybe Text
invoiceMiniObject InvoiceMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (InvoiceMiniState -> [Pair]) -> Maybe InvoiceMiniState -> [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])
-> (InvoiceMiniState -> Pair) -> InvoiceMiniState -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> InvoiceMiniState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (InvoiceMini -> Maybe InvoiceMiniState
invoiceMiniState InvoiceMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (InvoiceMiniType -> [Pair]) -> Maybe InvoiceMiniType -> [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])
-> (InvoiceMiniType -> Pair) -> InvoiceMiniType -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"type" Key -> InvoiceMiniType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (InvoiceMini -> Maybe InvoiceMiniType
invoiceMiniType InvoiceMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: InvoiceMini -> Encoding
toEncoding InvoiceMini
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
"business_entity_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..=)) (InvoiceMini -> Maybe Text
invoiceMiniBusiness_entity_id InvoiceMini
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..=)) (InvoiceMini -> Maybe Text
invoiceMiniId InvoiceMini
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
"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..=)) (InvoiceMini -> Maybe Text
invoiceMiniNumber InvoiceMini
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..=)) (InvoiceMini -> Maybe Text
invoiceMiniObject InvoiceMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (InvoiceMiniState -> [Series])
-> Maybe InvoiceMiniState
-> [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])
-> (InvoiceMiniState -> Series) -> InvoiceMiniState -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> InvoiceMiniState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (InvoiceMini -> Maybe InvoiceMiniState
invoiceMiniState InvoiceMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (InvoiceMiniType -> [Series])
-> Maybe InvoiceMiniType
-> [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])
-> (InvoiceMiniType -> Series) -> InvoiceMiniType -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"type" Key -> InvoiceMiniType -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (InvoiceMini -> Maybe InvoiceMiniType
invoiceMiniType InvoiceMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON InvoiceMini where
    parseJSON :: Value -> Parser InvoiceMini
parseJSON = String
-> (Object -> Parser InvoiceMini) -> Value -> Parser InvoiceMini
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"InvoiceMini" (\Object
obj -> ((((((Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe InvoiceMiniState
 -> Maybe InvoiceMiniType
 -> InvoiceMini)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe InvoiceMiniState
      -> Maybe InvoiceMiniType
      -> InvoiceMini)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe InvoiceMiniState
-> Maybe InvoiceMiniType
-> InvoiceMini
InvoiceMini Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe InvoiceMiniState
   -> Maybe InvoiceMiniType
   -> InvoiceMini)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe InvoiceMiniState
      -> Maybe InvoiceMiniType
      -> InvoiceMini)
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
"business_entity_id")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe InvoiceMiniState
   -> Maybe InvoiceMiniType
   -> InvoiceMini)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe InvoiceMiniState
      -> Maybe InvoiceMiniType
      -> InvoiceMini)
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 Text
   -> Maybe Text
   -> Maybe InvoiceMiniState
   -> Maybe InvoiceMiniType
   -> InvoiceMini)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe InvoiceMiniState -> Maybe InvoiceMiniType -> InvoiceMini)
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
"number")) Parser
  (Maybe Text
   -> Maybe InvoiceMiniState -> Maybe InvoiceMiniType -> InvoiceMini)
-> Parser (Maybe Text)
-> Parser
     (Maybe InvoiceMiniState -> Maybe InvoiceMiniType -> InvoiceMini)
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 InvoiceMiniState -> Maybe InvoiceMiniType -> InvoiceMini)
-> Parser (Maybe InvoiceMiniState)
-> Parser (Maybe InvoiceMiniType -> InvoiceMini)
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 InvoiceMiniState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"state")) Parser (Maybe InvoiceMiniType -> InvoiceMini)
-> Parser (Maybe InvoiceMiniType) -> Parser InvoiceMini
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 InvoiceMiniType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"type"))

-- | Create a new 'InvoiceMini' with all required fields.
mkInvoiceMini :: InvoiceMini
mkInvoiceMini :: InvoiceMini
mkInvoiceMini =
    InvoiceMini
        { invoiceMiniBusiness_entity_id :: Maybe Text
invoiceMiniBusiness_entity_id = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , invoiceMiniId :: Maybe Text
invoiceMiniId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , invoiceMiniNumber :: Maybe Text
invoiceMiniNumber = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , invoiceMiniObject :: Maybe Text
invoiceMiniObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , invoiceMiniState :: Maybe InvoiceMiniState
invoiceMiniState = Maybe InvoiceMiniState
forall a. Maybe a
GHC.Maybe.Nothing
        , invoiceMiniType :: Maybe InvoiceMiniType
invoiceMiniType = Maybe InvoiceMiniType
forall a. Maybe a
GHC.Maybe.Nothing
        }

-- | Defines the enum schema located at @components.schemas.InvoiceMini.properties.state@ in the specification.
data InvoiceMiniState
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      InvoiceMiniStateOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      InvoiceMiniStateTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"open"@
      InvoiceMiniStateEnumOpen
    | -- | Represents the JSON value @"pending"@
      InvoiceMiniStateEnumPending
    | -- | Represents the JSON value @"processing"@
      InvoiceMiniStateEnumProcessing
    | -- | Represents the JSON value @"past_due"@
      InvoiceMiniStateEnumPast_due
    | -- | Represents the JSON value @"paid"@
      InvoiceMiniStateEnumPaid
    | -- | Represents the JSON value @"closed"@
      InvoiceMiniStateEnumClosed
    | -- | Represents the JSON value @"failed"@
      InvoiceMiniStateEnumFailed
    | -- | Represents the JSON value @"voided"@
      InvoiceMiniStateEnumVoided
    deriving (Int -> InvoiceMiniState -> ShowS
[InvoiceMiniState] -> ShowS
InvoiceMiniState -> String
(Int -> InvoiceMiniState -> ShowS)
-> (InvoiceMiniState -> String)
-> ([InvoiceMiniState] -> ShowS)
-> Show InvoiceMiniState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvoiceMiniState -> ShowS
showsPrec :: Int -> InvoiceMiniState -> ShowS
$cshow :: InvoiceMiniState -> String
show :: InvoiceMiniState -> String
$cshowList :: [InvoiceMiniState] -> ShowS
showList :: [InvoiceMiniState] -> ShowS
GHC.Show.Show, InvoiceMiniState -> InvoiceMiniState -> Bool
(InvoiceMiniState -> InvoiceMiniState -> Bool)
-> (InvoiceMiniState -> InvoiceMiniState -> Bool)
-> Eq InvoiceMiniState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InvoiceMiniState -> InvoiceMiniState -> Bool
== :: InvoiceMiniState -> InvoiceMiniState -> Bool
$c/= :: InvoiceMiniState -> InvoiceMiniState -> Bool
/= :: InvoiceMiniState -> InvoiceMiniState -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceMiniState where
    toJSON :: InvoiceMiniState -> Value
toJSON (InvoiceMiniStateOther Value
val) = Value
val
    toJSON (InvoiceMiniStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumOpen) = Value
"open"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumPending) = Value
"pending"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumProcessing) = Value
"processing"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumPast_due) = Value
"past_due"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumPaid) = Value
"paid"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumClosed) = Value
"closed"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumFailed) = Value
"failed"
    toJSON (InvoiceMiniState
InvoiceMiniStateEnumVoided) = Value
"voided"
instance Data.Aeson.Types.FromJSON.FromJSON InvoiceMiniState where
    parseJSON :: Value -> Parser InvoiceMiniState
parseJSON Value
val =
        InvoiceMiniState -> Parser InvoiceMiniState
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
"open" -> InvoiceMiniState
InvoiceMiniStateEnumOpen
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"pending" -> InvoiceMiniState
InvoiceMiniStateEnumPending
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"processing" -> InvoiceMiniState
InvoiceMiniStateEnumProcessing
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"past_due" -> InvoiceMiniState
InvoiceMiniStateEnumPast_due
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"paid" -> InvoiceMiniState
InvoiceMiniStateEnumPaid
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"closed" -> InvoiceMiniState
InvoiceMiniStateEnumClosed
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"failed" -> InvoiceMiniState
InvoiceMiniStateEnumFailed
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"voided" -> InvoiceMiniState
InvoiceMiniStateEnumVoided
                | Bool
GHC.Base.otherwise -> Value -> InvoiceMiniState
InvoiceMiniStateOther Value
val
            )

-- | Defines the enum schema located at @components.schemas.InvoiceMini.properties.type@ in the specification.
data InvoiceMiniType
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      InvoiceMiniTypeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      InvoiceMiniTypeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"charge"@
      InvoiceMiniTypeEnumCharge
    | -- | Represents the JSON value @"credit"@
      InvoiceMiniTypeEnumCredit
    | -- | Represents the JSON value @"legacy"@
      InvoiceMiniTypeEnumLegacy
    deriving (Int -> InvoiceMiniType -> ShowS
[InvoiceMiniType] -> ShowS
InvoiceMiniType -> String
(Int -> InvoiceMiniType -> ShowS)
-> (InvoiceMiniType -> String)
-> ([InvoiceMiniType] -> ShowS)
-> Show InvoiceMiniType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvoiceMiniType -> ShowS
showsPrec :: Int -> InvoiceMiniType -> ShowS
$cshow :: InvoiceMiniType -> String
show :: InvoiceMiniType -> String
$cshowList :: [InvoiceMiniType] -> ShowS
showList :: [InvoiceMiniType] -> ShowS
GHC.Show.Show, InvoiceMiniType -> InvoiceMiniType -> Bool
(InvoiceMiniType -> InvoiceMiniType -> Bool)
-> (InvoiceMiniType -> InvoiceMiniType -> Bool)
-> Eq InvoiceMiniType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InvoiceMiniType -> InvoiceMiniType -> Bool
== :: InvoiceMiniType -> InvoiceMiniType -> Bool
$c/= :: InvoiceMiniType -> InvoiceMiniType -> Bool
/= :: InvoiceMiniType -> InvoiceMiniType -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON InvoiceMiniType where
    toJSON :: InvoiceMiniType -> Value
toJSON (InvoiceMiniTypeOther Value
val) = Value
val
    toJSON (InvoiceMiniTypeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (InvoiceMiniType
InvoiceMiniTypeEnumCharge) = Value
"charge"
    toJSON (InvoiceMiniType
InvoiceMiniTypeEnumCredit) = Value
"credit"
    toJSON (InvoiceMiniType
InvoiceMiniTypeEnumLegacy) = Value
"legacy"
instance Data.Aeson.Types.FromJSON.FromJSON InvoiceMiniType where
    parseJSON :: Value -> Parser InvoiceMiniType
parseJSON Value
val =
        InvoiceMiniType -> Parser InvoiceMiniType
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
"charge" -> InvoiceMiniType
InvoiceMiniTypeEnumCharge
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"credit" -> InvoiceMiniType
InvoiceMiniTypeEnumCredit
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"legacy" -> InvoiceMiniType
InvoiceMiniTypeEnumLegacy
                | Bool
GHC.Base.otherwise -> Value -> InvoiceMiniType
InvoiceMiniTypeOther Value
val
            )