module U.Codebase.Sqlite.ProjectBranch
  ( ProjectBranch (..),
  )
where

import U.Codebase.Sqlite.DbId (ProjectBranchId, ProjectId)
import Unison.Core.Orphans.Sqlite ()
import Unison.Core.Project (ProjectBranchName)
import Unison.Prelude
import Unison.Sqlite (FromRow, ToRow)

-- | A project branch.
data ProjectBranch = ProjectBranch
  { ProjectBranch -> ProjectId
projectId :: !ProjectId,
    ProjectBranch -> ProjectBranchId
branchId :: !ProjectBranchId,
    ProjectBranch -> ProjectBranchName
name :: !ProjectBranchName,
    ProjectBranch -> Maybe ProjectBranchId
parentBranchId :: !(Maybe ProjectBranchId)
  }
  deriving stock (ProjectBranch -> ProjectBranch -> Bool
(ProjectBranch -> ProjectBranch -> Bool)
-> (ProjectBranch -> ProjectBranch -> Bool) -> Eq ProjectBranch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProjectBranch -> ProjectBranch -> Bool
== :: ProjectBranch -> ProjectBranch -> Bool
$c/= :: ProjectBranch -> ProjectBranch -> Bool
/= :: ProjectBranch -> ProjectBranch -> Bool
Eq, (forall x. ProjectBranch -> Rep ProjectBranch x)
-> (forall x. Rep ProjectBranch x -> ProjectBranch)
-> Generic ProjectBranch
forall x. Rep ProjectBranch x -> ProjectBranch
forall x. ProjectBranch -> Rep ProjectBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ProjectBranch -> Rep ProjectBranch x
from :: forall x. ProjectBranch -> Rep ProjectBranch x
$cto :: forall x. Rep ProjectBranch x -> ProjectBranch
to :: forall x. Rep ProjectBranch x -> ProjectBranch
Generic, Int -> ProjectBranch -> ShowS
[ProjectBranch] -> ShowS
ProjectBranch -> String
(Int -> ProjectBranch -> ShowS)
-> (ProjectBranch -> String)
-> ([ProjectBranch] -> ShowS)
-> Show ProjectBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProjectBranch -> ShowS
showsPrec :: Int -> ProjectBranch -> ShowS
$cshow :: ProjectBranch -> String
show :: ProjectBranch -> String
$cshowList :: [ProjectBranch] -> ShowS
showList :: [ProjectBranch] -> ShowS
Show)
  deriving anyclass (ProjectBranch -> [SQLData]
(ProjectBranch -> [SQLData]) -> ToRow ProjectBranch
forall a. (a -> [SQLData]) -> ToRow a
$ctoRow :: ProjectBranch -> [SQLData]
toRow :: ProjectBranch -> [SQLData]
ToRow, RowParser ProjectBranch
RowParser ProjectBranch -> FromRow ProjectBranch
forall a. RowParser a -> FromRow a
$cfromRow :: RowParser ProjectBranch
fromRow :: RowParser ProjectBranch
FromRow)