{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}

module Hercules.API.State.StateLockLease where

import Hercules.API.Accounts.SimpleAccount (SimpleAccount)
import Hercules.API.Prelude
import Hercules.API.Projects.SimpleJob (SimpleJob)

data StateLockLease = StateLockLease
  { StateLockLease -> Id "StateLockLease"
id :: Id "StateLockLease",
    -- | When the lease was granted.
    StateLockLease -> UTCTime
startTime :: UTCTime,
    -- | Time of expiry. The lease can be terminated or extended by the actor.
    StateLockLease -> UTCTime
expirationTime :: UTCTime,
    -- | In case the lock was acquired by a user.
    StateLockLease -> Maybe SimpleAccount
user :: Maybe SimpleAccount,
    -- | In case the lock was acquired by an effect.
    StateLockLease -> Maybe SimpleJob
job :: Maybe SimpleJob,
    -- | User-provided text describing the reason to lock. May be empty.
    StateLockLease -> Text
description :: Text,
    -- | A pre-existing lock lease. This allows a lease to be granted when the
    -- actor knows it already has a lock lease.
    StateLockLease -> Maybe (Id "StateLockLease")
parent :: Maybe (Id "StateLockLease"),
    -- | Whether the lock is exclusive.
    StateLockLease -> Bool
exclusive :: Bool
  }
  deriving ((forall x. StateLockLease -> Rep StateLockLease x)
-> (forall x. Rep StateLockLease x -> StateLockLease)
-> Generic StateLockLease
forall x. Rep StateLockLease x -> StateLockLease
forall x. StateLockLease -> Rep StateLockLease x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StateLockLease x -> StateLockLease
$cfrom :: forall x. StateLockLease -> Rep StateLockLease x
Generic, Int -> StateLockLease -> ShowS
[StateLockLease] -> ShowS
StateLockLease -> String
(Int -> StateLockLease -> ShowS)
-> (StateLockLease -> String)
-> ([StateLockLease] -> ShowS)
-> Show StateLockLease
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateLockLease] -> ShowS
$cshowList :: [StateLockLease] -> ShowS
show :: StateLockLease -> String
$cshow :: StateLockLease -> String
showsPrec :: Int -> StateLockLease -> ShowS
$cshowsPrec :: Int -> StateLockLease -> ShowS
Show, StateLockLease -> StateLockLease -> Bool
(StateLockLease -> StateLockLease -> Bool)
-> (StateLockLease -> StateLockLease -> Bool) -> Eq StateLockLease
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateLockLease -> StateLockLease -> Bool
$c/= :: StateLockLease -> StateLockLease -> Bool
== :: StateLockLease -> StateLockLease -> Bool
$c== :: StateLockLease -> StateLockLease -> Bool
Eq, StateLockLease -> ()
(StateLockLease -> ()) -> NFData StateLockLease
forall a. (a -> ()) -> NFData a
rnf :: StateLockLease -> ()
$crnf :: StateLockLease -> ()
NFData, [StateLockLease] -> Encoding
[StateLockLease] -> Value
StateLockLease -> Encoding
StateLockLease -> Value
(StateLockLease -> Value)
-> (StateLockLease -> Encoding)
-> ([StateLockLease] -> Value)
-> ([StateLockLease] -> Encoding)
-> ToJSON StateLockLease
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [StateLockLease] -> Encoding
$ctoEncodingList :: [StateLockLease] -> Encoding
toJSONList :: [StateLockLease] -> Value
$ctoJSONList :: [StateLockLease] -> Value
toEncoding :: StateLockLease -> Encoding
$ctoEncoding :: StateLockLease -> Encoding
toJSON :: StateLockLease -> Value
$ctoJSON :: StateLockLease -> Value
ToJSON, Value -> Parser [StateLockLease]
Value -> Parser StateLockLease
(Value -> Parser StateLockLease)
-> (Value -> Parser [StateLockLease]) -> FromJSON StateLockLease
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [StateLockLease]
$cparseJSONList :: Value -> Parser [StateLockLease]
parseJSON :: Value -> Parser StateLockLease
$cparseJSON :: Value -> Parser StateLockLease
FromJSON, Proxy StateLockLease -> Declare (Definitions Schema) NamedSchema
(Proxy StateLockLease -> Declare (Definitions Schema) NamedSchema)
-> ToSchema StateLockLease
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy StateLockLease -> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy StateLockLease -> Declare (Definitions Schema) NamedSchema
ToSchema)