# domains/framework/ontology/defaults.ncl
# Shared mode factory helpers for Library, Service, and Tool projects.
# Projects import via:
#   let d = import "framework/ontology/defaults.ncl" in
#   d.make_mode String { id = "my-mode", trigger = "...", steps = [...] }

let s = import "schema.ncl" in
let c = import "constraints.ncl" in

{
  make_mode = fun ActionContract => fun data =>
    let result | (s.Mode ActionContract) = data in
    let result | c.NonEmptySteps         = result in
    let result | c.ValidTrigger          = result in
    result,

  make_step = fun ActionContract => fun data =>
    data | (s.ActionStep ActionContract),

  Mode       = s.Mode,
  ActionStep = s.ActionStep,
  Dependency = s.Dependency,
  OnError    = s.OnError,
  Guard      = s.Guard,
  Converge   = s.Converge,
}
