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

module Hercules.API.State.StateLockAcquireResponse where

import Hercules.API.Prelude
import Hercules.API.State.StateLockLease (StateLockLease)

data StateLockAcquireResponse
  = Acquired StateLockAcquiredResponse
  | Blocked StateLockBlockedResponse
  deriving ((forall x.
 StateLockAcquireResponse -> Rep StateLockAcquireResponse x)
-> (forall x.
    Rep StateLockAcquireResponse x -> StateLockAcquireResponse)
-> Generic StateLockAcquireResponse
forall x.
Rep StateLockAcquireResponse x -> StateLockAcquireResponse
forall x.
StateLockAcquireResponse -> Rep StateLockAcquireResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StateLockAcquireResponse x -> StateLockAcquireResponse
$cfrom :: forall x.
StateLockAcquireResponse -> Rep StateLockAcquireResponse x
Generic, Int -> StateLockAcquireResponse -> ShowS
[StateLockAcquireResponse] -> ShowS
StateLockAcquireResponse -> String
(Int -> StateLockAcquireResponse -> ShowS)
-> (StateLockAcquireResponse -> String)
-> ([StateLockAcquireResponse] -> ShowS)
-> Show StateLockAcquireResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateLockAcquireResponse] -> ShowS
$cshowList :: [StateLockAcquireResponse] -> ShowS
show :: StateLockAcquireResponse -> String
$cshow :: StateLockAcquireResponse -> String
showsPrec :: Int -> StateLockAcquireResponse -> ShowS
$cshowsPrec :: Int -> StateLockAcquireResponse -> ShowS
Show, StateLockAcquireResponse -> StateLockAcquireResponse -> Bool
(StateLockAcquireResponse -> StateLockAcquireResponse -> Bool)
-> (StateLockAcquireResponse -> StateLockAcquireResponse -> Bool)
-> Eq StateLockAcquireResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateLockAcquireResponse -> StateLockAcquireResponse -> Bool
$c/= :: StateLockAcquireResponse -> StateLockAcquireResponse -> Bool
== :: StateLockAcquireResponse -> StateLockAcquireResponse -> Bool
$c== :: StateLockAcquireResponse -> StateLockAcquireResponse -> Bool
Eq, StateLockAcquireResponse -> ()
(StateLockAcquireResponse -> ()) -> NFData StateLockAcquireResponse
forall a. (a -> ()) -> NFData a
rnf :: StateLockAcquireResponse -> ()
$crnf :: StateLockAcquireResponse -> ()
NFData, [StateLockAcquireResponse] -> Encoding
[StateLockAcquireResponse] -> Value
StateLockAcquireResponse -> Encoding
StateLockAcquireResponse -> Value
(StateLockAcquireResponse -> Value)
-> (StateLockAcquireResponse -> Encoding)
-> ([StateLockAcquireResponse] -> Value)
-> ([StateLockAcquireResponse] -> Encoding)
-> ToJSON StateLockAcquireResponse
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [StateLockAcquireResponse] -> Encoding
$ctoEncodingList :: [StateLockAcquireResponse] -> Encoding
toJSONList :: [StateLockAcquireResponse] -> Value
$ctoJSONList :: [StateLockAcquireResponse] -> Value
toEncoding :: StateLockAcquireResponse -> Encoding
$ctoEncoding :: StateLockAcquireResponse -> Encoding
toJSON :: StateLockAcquireResponse -> Value
$ctoJSON :: StateLockAcquireResponse -> Value
ToJSON, Value -> Parser [StateLockAcquireResponse]
Value -> Parser StateLockAcquireResponse
(Value -> Parser StateLockAcquireResponse)
-> (Value -> Parser [StateLockAcquireResponse])
-> FromJSON StateLockAcquireResponse
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [StateLockAcquireResponse]
$cparseJSONList :: Value -> Parser [StateLockAcquireResponse]
parseJSON :: Value -> Parser StateLockAcquireResponse
$cparseJSON :: Value -> Parser StateLockAcquireResponse
FromJSON, Proxy StateLockAcquireResponse
-> Declare (Definitions Schema) NamedSchema
(Proxy StateLockAcquireResponse
 -> Declare (Definitions Schema) NamedSchema)
-> ToSchema StateLockAcquireResponse
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy StateLockAcquireResponse
-> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy StateLockAcquireResponse
-> Declare (Definitions Schema) NamedSchema
ToSchema)

data StateLockAcquiredResponse = StateLockAcquiredResponse
  { StateLockAcquiredResponse -> Id "StateLockLease"
leaseId :: Id "StateLockLease",
    StateLockAcquiredResponse -> UTCTime
expirationTime :: UTCTime
  }
  deriving ((forall x.
 StateLockAcquiredResponse -> Rep StateLockAcquiredResponse x)
-> (forall x.
    Rep StateLockAcquiredResponse x -> StateLockAcquiredResponse)
-> Generic StateLockAcquiredResponse
forall x.
Rep StateLockAcquiredResponse x -> StateLockAcquiredResponse
forall x.
StateLockAcquiredResponse -> Rep StateLockAcquiredResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StateLockAcquiredResponse x -> StateLockAcquiredResponse
$cfrom :: forall x.
StateLockAcquiredResponse -> Rep StateLockAcquiredResponse x
Generic, Int -> StateLockAcquiredResponse -> ShowS
[StateLockAcquiredResponse] -> ShowS
StateLockAcquiredResponse -> String
(Int -> StateLockAcquiredResponse -> ShowS)
-> (StateLockAcquiredResponse -> String)
-> ([StateLockAcquiredResponse] -> ShowS)
-> Show StateLockAcquiredResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateLockAcquiredResponse] -> ShowS
$cshowList :: [StateLockAcquiredResponse] -> ShowS
show :: StateLockAcquiredResponse -> String
$cshow :: StateLockAcquiredResponse -> String
showsPrec :: Int -> StateLockAcquiredResponse -> ShowS
$cshowsPrec :: Int -> StateLockAcquiredResponse -> ShowS
Show, StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool
(StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool)
-> (StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool)
-> Eq StateLockAcquiredResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool
$c/= :: StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool
== :: StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool
$c== :: StateLockAcquiredResponse -> StateLockAcquiredResponse -> Bool
Eq, StateLockAcquiredResponse -> ()
(StateLockAcquiredResponse -> ())
-> NFData StateLockAcquiredResponse
forall a. (a -> ()) -> NFData a
rnf :: StateLockAcquiredResponse -> ()
$crnf :: StateLockAcquiredResponse -> ()
NFData, [StateLockAcquiredResponse] -> Encoding
[StateLockAcquiredResponse] -> Value
StateLockAcquiredResponse -> Encoding
StateLockAcquiredResponse -> Value
(StateLockAcquiredResponse -> Value)
-> (StateLockAcquiredResponse -> Encoding)
-> ([StateLockAcquiredResponse] -> Value)
-> ([StateLockAcquiredResponse] -> Encoding)
-> ToJSON StateLockAcquiredResponse
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [StateLockAcquiredResponse] -> Encoding
$ctoEncodingList :: [StateLockAcquiredResponse] -> Encoding
toJSONList :: [StateLockAcquiredResponse] -> Value
$ctoJSONList :: [StateLockAcquiredResponse] -> Value
toEncoding :: StateLockAcquiredResponse -> Encoding
$ctoEncoding :: StateLockAcquiredResponse -> Encoding
toJSON :: StateLockAcquiredResponse -> Value
$ctoJSON :: StateLockAcquiredResponse -> Value
ToJSON, Value -> Parser [StateLockAcquiredResponse]
Value -> Parser StateLockAcquiredResponse
(Value -> Parser StateLockAcquiredResponse)
-> (Value -> Parser [StateLockAcquiredResponse])
-> FromJSON StateLockAcquiredResponse
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [StateLockAcquiredResponse]
$cparseJSONList :: Value -> Parser [StateLockAcquiredResponse]
parseJSON :: Value -> Parser StateLockAcquiredResponse
$cparseJSON :: Value -> Parser StateLockAcquiredResponse
FromJSON, Proxy StateLockAcquiredResponse
-> Declare (Definitions Schema) NamedSchema
(Proxy StateLockAcquiredResponse
 -> Declare (Definitions Schema) NamedSchema)
-> ToSchema StateLockAcquiredResponse
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy StateLockAcquiredResponse
-> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy StateLockAcquiredResponse
-> Declare (Definitions Schema) NamedSchema
ToSchema)

data StateLockBlockedResponse = LockBlockedResponse
  { StateLockBlockedResponse -> [StateLockLease]
blockedByLeases :: [StateLockLease]
  }
  deriving ((forall x.
 StateLockBlockedResponse -> Rep StateLockBlockedResponse x)
-> (forall x.
    Rep StateLockBlockedResponse x -> StateLockBlockedResponse)
-> Generic StateLockBlockedResponse
forall x.
Rep StateLockBlockedResponse x -> StateLockBlockedResponse
forall x.
StateLockBlockedResponse -> Rep StateLockBlockedResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StateLockBlockedResponse x -> StateLockBlockedResponse
$cfrom :: forall x.
StateLockBlockedResponse -> Rep StateLockBlockedResponse x
Generic, Int -> StateLockBlockedResponse -> ShowS
[StateLockBlockedResponse] -> ShowS
StateLockBlockedResponse -> String
(Int -> StateLockBlockedResponse -> ShowS)
-> (StateLockBlockedResponse -> String)
-> ([StateLockBlockedResponse] -> ShowS)
-> Show StateLockBlockedResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateLockBlockedResponse] -> ShowS
$cshowList :: [StateLockBlockedResponse] -> ShowS
show :: StateLockBlockedResponse -> String
$cshow :: StateLockBlockedResponse -> String
showsPrec :: Int -> StateLockBlockedResponse -> ShowS
$cshowsPrec :: Int -> StateLockBlockedResponse -> ShowS
Show, StateLockBlockedResponse -> StateLockBlockedResponse -> Bool
(StateLockBlockedResponse -> StateLockBlockedResponse -> Bool)
-> (StateLockBlockedResponse -> StateLockBlockedResponse -> Bool)
-> Eq StateLockBlockedResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateLockBlockedResponse -> StateLockBlockedResponse -> Bool
$c/= :: StateLockBlockedResponse -> StateLockBlockedResponse -> Bool
== :: StateLockBlockedResponse -> StateLockBlockedResponse -> Bool
$c== :: StateLockBlockedResponse -> StateLockBlockedResponse -> Bool
Eq, StateLockBlockedResponse -> ()
(StateLockBlockedResponse -> ()) -> NFData StateLockBlockedResponse
forall a. (a -> ()) -> NFData a
rnf :: StateLockBlockedResponse -> ()
$crnf :: StateLockBlockedResponse -> ()
NFData, [StateLockBlockedResponse] -> Encoding
[StateLockBlockedResponse] -> Value
StateLockBlockedResponse -> Encoding
StateLockBlockedResponse -> Value
(StateLockBlockedResponse -> Value)
-> (StateLockBlockedResponse -> Encoding)
-> ([StateLockBlockedResponse] -> Value)
-> ([StateLockBlockedResponse] -> Encoding)
-> ToJSON StateLockBlockedResponse
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [StateLockBlockedResponse] -> Encoding
$ctoEncodingList :: [StateLockBlockedResponse] -> Encoding
toJSONList :: [StateLockBlockedResponse] -> Value
$ctoJSONList :: [StateLockBlockedResponse] -> Value
toEncoding :: StateLockBlockedResponse -> Encoding
$ctoEncoding :: StateLockBlockedResponse -> Encoding
toJSON :: StateLockBlockedResponse -> Value
$ctoJSON :: StateLockBlockedResponse -> Value
ToJSON, Value -> Parser [StateLockBlockedResponse]
Value -> Parser StateLockBlockedResponse
(Value -> Parser StateLockBlockedResponse)
-> (Value -> Parser [StateLockBlockedResponse])
-> FromJSON StateLockBlockedResponse
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [StateLockBlockedResponse]
$cparseJSONList :: Value -> Parser [StateLockBlockedResponse]
parseJSON :: Value -> Parser StateLockBlockedResponse
$cparseJSON :: Value -> Parser StateLockBlockedResponse
FromJSON, Proxy StateLockBlockedResponse
-> Declare (Definitions Schema) NamedSchema
(Proxy StateLockBlockedResponse
 -> Declare (Definitions Schema) NamedSchema)
-> ToSchema StateLockBlockedResponse
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy StateLockBlockedResponse
-> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy StateLockBlockedResponse
-> Declare (Definitions Schema) NamedSchema
ToSchema)