{-# 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 DeletedPerson
module StripeAPI.Types.DeletedPerson 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.deleted_person@ in the specification.
data DeletedPerson = DeletedPerson
  { -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    DeletedPerson -> Text
deletedPersonId :: Data.Text.Internal.Text
  }
  deriving
    ( Int -> DeletedPerson -> ShowS
[DeletedPerson] -> ShowS
DeletedPerson -> String
(Int -> DeletedPerson -> ShowS)
-> (DeletedPerson -> String)
-> ([DeletedPerson] -> ShowS)
-> Show DeletedPerson
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletedPerson] -> ShowS
$cshowList :: [DeletedPerson] -> ShowS
show :: DeletedPerson -> String
$cshow :: DeletedPerson -> String
showsPrec :: Int -> DeletedPerson -> ShowS
$cshowsPrec :: Int -> DeletedPerson -> ShowS
GHC.Show.Show,
      DeletedPerson -> DeletedPerson -> Bool
(DeletedPerson -> DeletedPerson -> Bool)
-> (DeletedPerson -> DeletedPerson -> Bool) -> Eq DeletedPerson
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletedPerson -> DeletedPerson -> Bool
$c/= :: DeletedPerson -> DeletedPerson -> Bool
== :: DeletedPerson -> DeletedPerson -> Bool
$c== :: DeletedPerson -> DeletedPerson -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON DeletedPerson where
  toJSON :: DeletedPerson -> Value
toJSON DeletedPerson
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeletedPerson -> Text
deletedPersonId DeletedPerson
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"deleted" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Bool -> Value
Data.Aeson.Types.Internal.Bool Bool
GHC.Types.True Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"person" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: DeletedPerson -> Encoding
toEncoding DeletedPerson
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= DeletedPerson -> Text
deletedPersonId DeletedPerson
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"deleted" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Bool -> Value
Data.Aeson.Types.Internal.Bool Bool
GHC.Types.True) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"person")))

instance Data.Aeson.Types.FromJSON.FromJSON DeletedPerson where
  parseJSON :: Value -> Parser DeletedPerson
parseJSON = String
-> (Object -> Parser DeletedPerson)
-> Value
-> Parser DeletedPerson
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"DeletedPerson" (\Object
obj -> (Text -> DeletedPerson) -> Parser (Text -> DeletedPerson)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text -> DeletedPerson
DeletedPerson Parser (Text -> DeletedPerson)
-> Parser Text -> Parser DeletedPerson
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"id"))

-- | Create a new 'DeletedPerson' with all required fields.
mkDeletedPerson ::
  -- | 'deletedPersonId'
  Data.Text.Internal.Text ->
  DeletedPerson
mkDeletedPerson :: Text -> DeletedPerson
mkDeletedPerson Text
deletedPersonId = DeletedPerson :: Text -> DeletedPerson
DeletedPerson {deletedPersonId :: Text
deletedPersonId = Text
deletedPersonId}