{-# LANGUAGE DeriveAnyClass #-}

module Hercules.API.Derivation where

import Hercules.API.Prelude hiding (either)

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

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

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