module Cachix.Types.Deployment where

import Data.Aeson
  ( FromJSON,
    ToJSON,
  )
import Data.Swagger (ToSchema)
import Data.Time.Clock (UTCTime)
import Data.UUID (UUID)
import Protolude

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

data Deployment = Deployment
  { Deployment -> UUID
id :: UUID,
    Deployment -> Int64
index :: Int64,
    Deployment -> UTCTime
createdOn :: UTCTime,
    Deployment -> Maybe UTCTime
startedOn :: Maybe UTCTime,
    Deployment -> Text
storePath :: Text,
    Deployment -> Maybe Int64
closureSize :: Maybe Int64,
    Deployment -> Status
status :: Status
  }
  deriving stock (Int -> Deployment -> ShowS
[Deployment] -> ShowS
Deployment -> String
(Int -> Deployment -> ShowS)
-> (Deployment -> String)
-> ([Deployment] -> ShowS)
-> Show Deployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Deployment -> ShowS
showsPrec :: Int -> Deployment -> ShowS
$cshow :: Deployment -> String
show :: Deployment -> String
$cshowList :: [Deployment] -> ShowS
showList :: [Deployment] -> ShowS
Show, (forall x. Deployment -> Rep Deployment x)
-> (forall x. Rep Deployment x -> Deployment) -> Generic Deployment
forall x. Rep Deployment x -> Deployment
forall x. Deployment -> Rep Deployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Deployment -> Rep Deployment x
from :: forall x. Deployment -> Rep Deployment x
$cto :: forall x. Rep Deployment x -> Deployment
to :: forall x. Rep Deployment x -> Deployment
Generic)
  deriving anyclass (Value -> Parser [Deployment]
Value -> Parser Deployment
(Value -> Parser Deployment)
-> (Value -> Parser [Deployment]) -> FromJSON Deployment
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser Deployment
parseJSON :: Value -> Parser Deployment
$cparseJSONList :: Value -> Parser [Deployment]
parseJSONList :: Value -> Parser [Deployment]
FromJSON, [Deployment] -> Value
[Deployment] -> Encoding
Deployment -> Value
Deployment -> Encoding
(Deployment -> Value)
-> (Deployment -> Encoding)
-> ([Deployment] -> Value)
-> ([Deployment] -> Encoding)
-> ToJSON Deployment
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: Deployment -> Value
toJSON :: Deployment -> Value
$ctoEncoding :: Deployment -> Encoding
toEncoding :: Deployment -> Encoding
$ctoJSONList :: [Deployment] -> Value
toJSONList :: [Deployment] -> Value
$ctoEncodingList :: [Deployment] -> Encoding
toEncodingList :: [Deployment] -> Encoding
ToJSON, Proxy Deployment -> Declare (Definitions Schema) NamedSchema
(Proxy Deployment -> Declare (Definitions Schema) NamedSchema)
-> ToSchema Deployment
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy Deployment -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy Deployment -> Declare (Definitions Schema) NamedSchema
ToSchema, Deployment -> ()
(Deployment -> ()) -> NFData Deployment
forall a. (a -> ()) -> NFData a
$crnf :: Deployment -> ()
rnf :: Deployment -> ()
NFData)