# Catalog declaration for the `greet_actor` operation — kind = 'Rust.
#
# Demonstrates the default path: a tier-2 op compiled into the daemon
# binary via inventory + #[onto_operation]. Typechecks against the
# co-located forward-looking schema; will typecheck against
# .ontoref/catalog/schema.ncl after migration 0025 is applied.
#
# Witness: signed Ed25519 over the canonical serialisation of the state
# delta (the new greeting string written to .ontology/state.ncl).

let s = import "../schema-future.ncl" in

(
  {
    id          = "greet_actor",
    description = "Returns a personalised greeting for the given actor id; records the latest greeting in the actor-greeting FSM dimension.",
    kind        = 'Rust,

    inputs = {
      actor_id = "String",
      tone     = "String",
    },

    constraints = {
      pre    = ["actor_exists", "tone_in_allowed_set"],
      inline = [],
      post   = ["greeting_recorded"],
    },

    validation_sla = 'Synchronous,

    effects = [
      {
        kind       = 'Update,
        entity     = "FsmDimension",
        attrs      = ["current_state"],
        dimensions = ["actor-greeting"],
      },
    ],

    witness_shape = {
      payload_kind = "actor_greeting_recorded",
      proof_paths  = ["fsm_dimension/actor-greeting/current_state"],
      signature    = { actor_id = "developer", algorithm = "Ed25519" },
    },

    actor_policy = { roles = ["developer", "admin", "ci"] },

    render_paths = [".ontology/state.ncl"],
  } | s.OperationDecl | s.OndaodPreRequired
)
