{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
module Hercules.API.Projects.SimpleJob where
import Data.OpenApi qualified as O3
import Hercules.API.Prelude
import Hercules.API.Projects.SimpleProject (SimpleProject)
data SimpleJob = SimpleJob
{ SimpleJob -> Id "Job"
id :: Id "Job",
SimpleJob -> SimpleProject
project :: SimpleProject,
SimpleJob -> Int64
index :: Int64,
SimpleJob -> JobStatus
status :: JobStatus,
SimpleJob -> JobPhase
phase :: JobPhase
}
deriving ((forall x. SimpleJob -> Rep SimpleJob x)
-> (forall x. Rep SimpleJob x -> SimpleJob) -> Generic SimpleJob
forall x. Rep SimpleJob x -> SimpleJob
forall x. SimpleJob -> Rep SimpleJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SimpleJob -> Rep SimpleJob x
from :: forall x. SimpleJob -> Rep SimpleJob x
$cto :: forall x. Rep SimpleJob x -> SimpleJob
to :: forall x. Rep SimpleJob x -> SimpleJob
Generic, Int -> SimpleJob -> ShowS
[SimpleJob] -> ShowS
SimpleJob -> String
(Int -> SimpleJob -> ShowS)
-> (SimpleJob -> String)
-> ([SimpleJob] -> ShowS)
-> Show SimpleJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SimpleJob -> ShowS
showsPrec :: Int -> SimpleJob -> ShowS
$cshow :: SimpleJob -> String
show :: SimpleJob -> String
$cshowList :: [SimpleJob] -> ShowS
showList :: [SimpleJob] -> ShowS
Show, SimpleJob -> SimpleJob -> Bool
(SimpleJob -> SimpleJob -> Bool)
-> (SimpleJob -> SimpleJob -> Bool) -> Eq SimpleJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SimpleJob -> SimpleJob -> Bool
== :: SimpleJob -> SimpleJob -> Bool
$c/= :: SimpleJob -> SimpleJob -> Bool
/= :: SimpleJob -> SimpleJob -> Bool
Eq)
deriving anyclass (SimpleJob -> ()
(SimpleJob -> ()) -> NFData SimpleJob
forall a. (a -> ()) -> NFData a
$crnf :: SimpleJob -> ()
rnf :: SimpleJob -> ()
NFData, [SimpleJob] -> Value
[SimpleJob] -> Encoding
SimpleJob -> Value
SimpleJob -> Encoding
(SimpleJob -> Value)
-> (SimpleJob -> Encoding)
-> ([SimpleJob] -> Value)
-> ([SimpleJob] -> Encoding)
-> ToJSON SimpleJob
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: SimpleJob -> Value
toJSON :: SimpleJob -> Value
$ctoEncoding :: SimpleJob -> Encoding
toEncoding :: SimpleJob -> Encoding
$ctoJSONList :: [SimpleJob] -> Value
toJSONList :: [SimpleJob] -> Value
$ctoEncodingList :: [SimpleJob] -> Encoding
toEncodingList :: [SimpleJob] -> Encoding
ToJSON, Value -> Parser [SimpleJob]
Value -> Parser SimpleJob
(Value -> Parser SimpleJob)
-> (Value -> Parser [SimpleJob]) -> FromJSON SimpleJob
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser SimpleJob
parseJSON :: Value -> Parser SimpleJob
$cparseJSONList :: Value -> Parser [SimpleJob]
parseJSONList :: Value -> Parser [SimpleJob]
FromJSON, Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema
(Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema)
-> ToSchema SimpleJob
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable SimpleJob
Typeable SimpleJob =>
(Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema)
-> ToSchema SimpleJob
Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy SimpleJob -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)
data JobPhase
= Queued
| Evaluating
| Building
| Effects
| Done
deriving ((forall x. JobPhase -> Rep JobPhase x)
-> (forall x. Rep JobPhase x -> JobPhase) -> Generic JobPhase
forall x. Rep JobPhase x -> JobPhase
forall x. JobPhase -> Rep JobPhase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JobPhase -> Rep JobPhase x
from :: forall x. JobPhase -> Rep JobPhase x
$cto :: forall x. Rep JobPhase x -> JobPhase
to :: forall x. Rep JobPhase x -> JobPhase
Generic, Int -> JobPhase -> ShowS
[JobPhase] -> ShowS
JobPhase -> String
(Int -> JobPhase -> ShowS)
-> (JobPhase -> String) -> ([JobPhase] -> ShowS) -> Show JobPhase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobPhase -> ShowS
showsPrec :: Int -> JobPhase -> ShowS
$cshow :: JobPhase -> String
show :: JobPhase -> String
$cshowList :: [JobPhase] -> ShowS
showList :: [JobPhase] -> ShowS
Show, JobPhase -> JobPhase -> Bool
(JobPhase -> JobPhase -> Bool)
-> (JobPhase -> JobPhase -> Bool) -> Eq JobPhase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JobPhase -> JobPhase -> Bool
== :: JobPhase -> JobPhase -> Bool
$c/= :: JobPhase -> JobPhase -> Bool
/= :: JobPhase -> JobPhase -> Bool
Eq)
deriving anyclass (JobPhase -> ()
(JobPhase -> ()) -> NFData JobPhase
forall a. (a -> ()) -> NFData a
$crnf :: JobPhase -> ()
rnf :: JobPhase -> ()
NFData, [JobPhase] -> Value
[JobPhase] -> Encoding
JobPhase -> Value
JobPhase -> Encoding
(JobPhase -> Value)
-> (JobPhase -> Encoding)
-> ([JobPhase] -> Value)
-> ([JobPhase] -> Encoding)
-> ToJSON JobPhase
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: JobPhase -> Value
toJSON :: JobPhase -> Value
$ctoEncoding :: JobPhase -> Encoding
toEncoding :: JobPhase -> Encoding
$ctoJSONList :: [JobPhase] -> Value
toJSONList :: [JobPhase] -> Value
$ctoEncodingList :: [JobPhase] -> Encoding
toEncodingList :: [JobPhase] -> Encoding
ToJSON, Value -> Parser [JobPhase]
Value -> Parser JobPhase
(Value -> Parser JobPhase)
-> (Value -> Parser [JobPhase]) -> FromJSON JobPhase
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser JobPhase
parseJSON :: Value -> Parser JobPhase
$cparseJSONList :: Value -> Parser [JobPhase]
parseJSONList :: Value -> Parser [JobPhase]
FromJSON, Proxy JobPhase -> Declare (Definitions Schema) NamedSchema
(Proxy JobPhase -> Declare (Definitions Schema) NamedSchema)
-> ToSchema JobPhase
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy JobPhase -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy JobPhase -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable JobPhase
Typeable JobPhase =>
(Proxy JobPhase -> Declare (Definitions Schema) NamedSchema)
-> ToSchema JobPhase
Proxy JobPhase -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy JobPhase -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy JobPhase -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)
data JobStatus
= Pending
| Failure
| Success
deriving ((forall x. JobStatus -> Rep JobStatus x)
-> (forall x. Rep JobStatus x -> JobStatus) -> Generic JobStatus
forall x. Rep JobStatus x -> JobStatus
forall x. JobStatus -> Rep JobStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. JobStatus -> Rep JobStatus x
from :: forall x. JobStatus -> Rep JobStatus x
$cto :: forall x. Rep JobStatus x -> JobStatus
to :: forall x. Rep JobStatus x -> JobStatus
Generic, Int -> JobStatus -> ShowS
[JobStatus] -> ShowS
JobStatus -> String
(Int -> JobStatus -> ShowS)
-> (JobStatus -> String)
-> ([JobStatus] -> ShowS)
-> Show JobStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JobStatus -> ShowS
showsPrec :: Int -> JobStatus -> ShowS
$cshow :: JobStatus -> String
show :: JobStatus -> String
$cshowList :: [JobStatus] -> ShowS
showList :: [JobStatus] -> ShowS
Show, JobStatus -> JobStatus -> Bool
(JobStatus -> JobStatus -> Bool)
-> (JobStatus -> JobStatus -> Bool) -> Eq JobStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JobStatus -> JobStatus -> Bool
== :: JobStatus -> JobStatus -> Bool
$c/= :: JobStatus -> JobStatus -> Bool
/= :: JobStatus -> JobStatus -> Bool
Eq)
deriving anyclass (JobStatus -> ()
(JobStatus -> ()) -> NFData JobStatus
forall a. (a -> ()) -> NFData a
$crnf :: JobStatus -> ()
rnf :: JobStatus -> ()
NFData, [JobStatus] -> Value
[JobStatus] -> Encoding
JobStatus -> Value
JobStatus -> Encoding
(JobStatus -> Value)
-> (JobStatus -> Encoding)
-> ([JobStatus] -> Value)
-> ([JobStatus] -> Encoding)
-> ToJSON JobStatus
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: JobStatus -> Value
toJSON :: JobStatus -> Value
$ctoEncoding :: JobStatus -> Encoding
toEncoding :: JobStatus -> Encoding
$ctoJSONList :: [JobStatus] -> Value
toJSONList :: [JobStatus] -> Value
$ctoEncodingList :: [JobStatus] -> Encoding
toEncodingList :: [JobStatus] -> Encoding
ToJSON, Value -> Parser [JobStatus]
Value -> Parser JobStatus
(Value -> Parser JobStatus)
-> (Value -> Parser [JobStatus]) -> FromJSON JobStatus
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser JobStatus
parseJSON :: Value -> Parser JobStatus
$cparseJSONList :: Value -> Parser [JobStatus]
parseJSONList :: Value -> Parser [JobStatus]
FromJSON, Proxy JobStatus -> Declare (Definitions Schema) NamedSchema
(Proxy JobStatus -> Declare (Definitions Schema) NamedSchema)
-> ToSchema JobStatus
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy JobStatus -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy JobStatus -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable JobStatus
Typeable JobStatus =>
(Proxy JobStatus -> Declare (Definitions Schema) NamedSchema)
-> ToSchema JobStatus
Proxy JobStatus -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy JobStatus -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy JobStatus -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)
instance Semigroup JobStatus where
JobStatus
Failure <> :: JobStatus -> JobStatus -> JobStatus
<> JobStatus
_ = JobStatus
Failure
JobStatus
_ <> JobStatus
Failure = JobStatus
Failure
JobStatus
Pending <> JobStatus
_ = JobStatus
Pending
JobStatus
_ <> JobStatus
Pending = JobStatus
Pending
JobStatus
Success <> JobStatus
Success = JobStatus
Success
instance Monoid JobStatus where
mappend :: JobStatus -> JobStatus -> JobStatus
mappend = JobStatus -> JobStatus -> JobStatus
forall a. Semigroup a => a -> a -> a
(<>)
mempty :: JobStatus
mempty = JobStatus
Success