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

instance Data.Aeson.Types.ToJSON.ToJSON DeletedTerminal'location where
  toJSON :: DeletedTerminal'location -> Value
toJSON DeletedTerminal'location
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..= DeletedTerminal'location -> Text
deletedTerminal'locationId DeletedTerminal'location
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
"terminal.location" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: DeletedTerminal'location -> Encoding
toEncoding DeletedTerminal'location
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..= DeletedTerminal'location -> Text
deletedTerminal'locationId DeletedTerminal'location
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
"terminal.location")))

instance Data.Aeson.Types.FromJSON.FromJSON DeletedTerminal'location where
  parseJSON :: Value -> Parser DeletedTerminal'location
parseJSON = String
-> (Object -> Parser DeletedTerminal'location)
-> Value
-> Parser DeletedTerminal'location
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"DeletedTerminal'location" (\Object
obj -> (Text -> DeletedTerminal'location)
-> Parser (Text -> DeletedTerminal'location)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Text -> DeletedTerminal'location
DeletedTerminal'location Parser (Text -> DeletedTerminal'location)
-> Parser Text -> Parser DeletedTerminal'location
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 'DeletedTerminal'location' with all required fields.
mkDeletedTerminal'location ::
  -- | 'deletedTerminal'locationId'
  Data.Text.Internal.Text ->
  DeletedTerminal'location
mkDeletedTerminal'location :: Text -> DeletedTerminal'location
mkDeletedTerminal'location Text
deletedTerminal'locationId = DeletedTerminal'location :: Text -> DeletedTerminal'location
DeletedTerminal'location {deletedTerminal'locationId :: Text
deletedTerminal'locationId = Text
deletedTerminal'locationId}