module Proteome.Data.ProjectMetadata where

import Ribosome (MsgpackDecode, MsgpackEncode)

import Proteome.Data.ProjectName (ProjectName (ProjectName))
import Proteome.Data.ProjectRoot (ProjectRoot)
import Proteome.Data.ProjectType (ProjectType)

data ProjectMetadata =
  DirProject {
    ProjectMetadata -> ProjectName
name :: ProjectName,
    ProjectMetadata -> ProjectRoot
root :: ProjectRoot,
    ProjectMetadata -> Maybe ProjectType
tpe :: Maybe ProjectType
  }
  |
  VirtualProject {
    name :: ProjectName
  }
  deriving stock (ProjectMetadata -> ProjectMetadata -> Bool
(ProjectMetadata -> ProjectMetadata -> Bool)
-> (ProjectMetadata -> ProjectMetadata -> Bool)
-> Eq ProjectMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectMetadata -> ProjectMetadata -> Bool
$c/= :: ProjectMetadata -> ProjectMetadata -> Bool
== :: ProjectMetadata -> ProjectMetadata -> Bool
$c== :: ProjectMetadata -> ProjectMetadata -> Bool
Eq, Int -> ProjectMetadata -> ShowS
[ProjectMetadata] -> ShowS
ProjectMetadata -> String
(Int -> ProjectMetadata -> ShowS)
-> (ProjectMetadata -> String)
-> ([ProjectMetadata] -> ShowS)
-> Show ProjectMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectMetadata] -> ShowS
$cshowList :: [ProjectMetadata] -> ShowS
show :: ProjectMetadata -> String
$cshow :: ProjectMetadata -> String
showsPrec :: Int -> ProjectMetadata -> ShowS
$cshowsPrec :: Int -> ProjectMetadata -> ShowS
Show, (forall x. ProjectMetadata -> Rep ProjectMetadata x)
-> (forall x. Rep ProjectMetadata x -> ProjectMetadata)
-> Generic ProjectMetadata
forall x. Rep ProjectMetadata x -> ProjectMetadata
forall x. ProjectMetadata -> Rep ProjectMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectMetadata x -> ProjectMetadata
$cfrom :: forall x. ProjectMetadata -> Rep ProjectMetadata x
Generic)
  deriving anyclass (Object -> Either DecodeError ProjectMetadata
(Object -> Either DecodeError ProjectMetadata)
-> MsgpackDecode ProjectMetadata
forall a. (Object -> Either DecodeError a) -> MsgpackDecode a
fromMsgpack :: Object -> Either DecodeError ProjectMetadata
$cfromMsgpack :: Object -> Either DecodeError ProjectMetadata
MsgpackDecode, ProjectMetadata -> Object
(ProjectMetadata -> Object) -> MsgpackEncode ProjectMetadata
forall a. (a -> Object) -> MsgpackEncode a
toMsgpack :: ProjectMetadata -> Object
$ctoMsgpack :: ProjectMetadata -> Object
MsgpackEncode)

instance Default ProjectMetadata where
  def :: ProjectMetadata
def =
    ProjectName -> ProjectMetadata
VirtualProject (Text -> ProjectName
ProjectName Text
"main")