-- | Types of "Unison.Cli.Share.Projects", put in their own module to avoid cyclic dependencies.
--
-- Refer to that module's documentation, and use it instead if you can. It re-exports these types.
module Unison.Cli.Share.Projects.Types
  ( RemoteProject (..),
    RemoteProjectBranch (..),
  )
where

import U.Codebase.Sqlite.DbId (RemoteProjectBranchId (..), RemoteProjectId (..))
import Unison.Prelude
import Unison.Project (ProjectBranchName, ProjectName, Semver)
import Unison.Share.API.Hash qualified as Share.API

-- | A remote project.
data RemoteProject = RemoteProject
  { RemoteProject -> RemoteProjectId
projectId :: RemoteProjectId,
    RemoteProject -> ProjectName
projectName :: ProjectName,
    RemoteProject -> Maybe Semver
latestRelease :: Maybe Semver
  }
  deriving stock (RemoteProject -> RemoteProject -> Bool
(RemoteProject -> RemoteProject -> Bool)
-> (RemoteProject -> RemoteProject -> Bool) -> Eq RemoteProject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoteProject -> RemoteProject -> Bool
== :: RemoteProject -> RemoteProject -> Bool
$c/= :: RemoteProject -> RemoteProject -> Bool
/= :: RemoteProject -> RemoteProject -> Bool
Eq, (forall x. RemoteProject -> Rep RemoteProject x)
-> (forall x. Rep RemoteProject x -> RemoteProject)
-> Generic RemoteProject
forall x. Rep RemoteProject x -> RemoteProject
forall x. RemoteProject -> Rep RemoteProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RemoteProject -> Rep RemoteProject x
from :: forall x. RemoteProject -> Rep RemoteProject x
$cto :: forall x. Rep RemoteProject x -> RemoteProject
to :: forall x. Rep RemoteProject x -> RemoteProject
Generic, Int -> RemoteProject -> ShowS
[RemoteProject] -> ShowS
RemoteProject -> String
(Int -> RemoteProject -> ShowS)
-> (RemoteProject -> String)
-> ([RemoteProject] -> ShowS)
-> Show RemoteProject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoteProject -> ShowS
showsPrec :: Int -> RemoteProject -> ShowS
$cshow :: RemoteProject -> String
show :: RemoteProject -> String
$cshowList :: [RemoteProject] -> ShowS
showList :: [RemoteProject] -> ShowS
Show)

-- | A remote project branch.
data RemoteProjectBranch = RemoteProjectBranch
  { RemoteProjectBranch -> RemoteProjectId
projectId :: RemoteProjectId,
    RemoteProjectBranch -> ProjectName
projectName :: ProjectName,
    RemoteProjectBranch -> RemoteProjectBranchId
branchId :: RemoteProjectBranchId,
    RemoteProjectBranch -> ProjectBranchName
branchName :: ProjectBranchName,
    RemoteProjectBranch -> HashJWT
branchHead :: Share.API.HashJWT,
    -- The hash of the squashed version of the branch head, if it was requested.
    RemoteProjectBranch -> Maybe HashJWT
squashedBranchHead :: Maybe Share.API.HashJWT
  }
  deriving stock (RemoteProjectBranch -> RemoteProjectBranch -> Bool
(RemoteProjectBranch -> RemoteProjectBranch -> Bool)
-> (RemoteProjectBranch -> RemoteProjectBranch -> Bool)
-> Eq RemoteProjectBranch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoteProjectBranch -> RemoteProjectBranch -> Bool
== :: RemoteProjectBranch -> RemoteProjectBranch -> Bool
$c/= :: RemoteProjectBranch -> RemoteProjectBranch -> Bool
/= :: RemoteProjectBranch -> RemoteProjectBranch -> Bool
Eq, Int -> RemoteProjectBranch -> ShowS
[RemoteProjectBranch] -> ShowS
RemoteProjectBranch -> String
(Int -> RemoteProjectBranch -> ShowS)
-> (RemoteProjectBranch -> String)
-> ([RemoteProjectBranch] -> ShowS)
-> Show RemoteProjectBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoteProjectBranch -> ShowS
showsPrec :: Int -> RemoteProjectBranch -> ShowS
$cshow :: RemoteProjectBranch -> String
show :: RemoteProjectBranch -> String
$cshowList :: [RemoteProjectBranch] -> ShowS
showList :: [RemoteProjectBranch] -> ShowS
Show, (forall x. RemoteProjectBranch -> Rep RemoteProjectBranch x)
-> (forall x. Rep RemoteProjectBranch x -> RemoteProjectBranch)
-> Generic RemoteProjectBranch
forall x. Rep RemoteProjectBranch x -> RemoteProjectBranch
forall x. RemoteProjectBranch -> Rep RemoteProjectBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RemoteProjectBranch -> Rep RemoteProjectBranch x
from :: forall x. RemoteProjectBranch -> Rep RemoteProjectBranch x
$cto :: forall x. Rep RemoteProjectBranch x -> RemoteProjectBranch
to :: forall x. Rep RemoteProjectBranch x -> RemoteProjectBranch
Generic)