// Declare an incident — OPERATOR ONLY. The `guards: [{ scope: 'status:write' }]` // is enforced by the framework before the executor runs; `voltro check` sees it // statically. Declaring `guards:` merges `ScopeError` into the wire-error union // automatically (no `error:` needed). import { defineMutation } from '@voltro/protocol' import { Schema } from 'effect' export const createIncident = defineMutation({ name: 'incidents.create', target: { table: 'incidents', op: 'insert' }, guards: [{ scope: 'status:write' }], input: Schema.Struct({ title: Schema.NonEmptyString, impact: Schema.Literal('minor', 'major', 'critical'), }), output: Schema.Struct({ id: Schema.String, title: Schema.String, impact: Schema.String, status: Schema.String, }), })