# ~/.config/ontoref/schemas/ontoref-project.ncl — ProjectEntry contract.
# Installed by `just install-daemon`. Imported by per-project .ontoref/project.ncl files.

let KeyRole = [| 'admin, 'viewer |] in

let KeyEntry = {
  role  | KeyRole,
  hash  | String,
  label | String | default = "",
} in

let ProjectEntry = {
  slug                | String,
  # Absolute local path to the project root. Empty string for push_only projects.
  root                | String,
  # Import paths for nickel export on this project's NCL files (local projects only).
  nickel_import_paths | Array String | default = [],
  # Auth keys for this project. Empty = no auth required.
  keys                | Array KeyEntry | default = [],
  # Remote URL for push_only projects (git, SSH, HTTPS). Informational — not accessed by daemon.
  remote_url          | String | default = "",
  # When true: no local file watch, no NCL import. Project pushes ontology via POST /sync.
  push_only           | Bool   | default = false,
} in

{
  make_project        = fun fields => fields | ProjectEntry,
  make_remote_project = fun fields => (fields & { push_only = true, root = "", nickel_import_paths = [] }) | ProjectEntry,
}
