/** * The work order engine's declared operation surface (#707/#738). * * An engine declaring its operations is what lets a VERTICAL bind them to its * own URLs without restating them. Before this, `defineEngineRoutes` had to * carry an input schema the vertical wrote itself — a local `z.object({ orderId * })` standing in for a shape the engine only expressed as a TypeScript type — * and the operation NAME was an unchecked string, because `ModuleRegistration` * erases its keys. * * What is deliberately NOT here is `http`. An engine is entity-agnostic and owns * no URL shape: a bike shop calls the same work order a repair, and both are * right. The path is the composing vertical's decision, declared with * `defineEngineRoutes` against these names. * * `createWorkOrder` is absent for a different reason — it is an in-scope * function, not an operation. A vertical calls it inside its own transaction so * it can price, label and link in one go; exposing it as an invocable operation * would offer a second way in that skips all of that. */ import { z } from '@substrat-run/contracts'; /** The keys these operations check. Mirrors `PERM` in index.ts. */ export declare const WORKORDER_PERMISSIONS: readonly ['workorder:create', 'workorder:read', 'workorder:assign', 'workorder:report', 'workorder:complete', 'workorder:close']; export declare const workorderOperations: { readonly 'workorder/get': { readonly summary: "One work order with everything reported against it"; readonly permission: { readonly key: "workorder:read"; readonly entity: "workorder"; readonly idFrom: "orderId"; }; readonly input: z.ZodObject<{ orderId: z.ZodString; }, z.core.$strip>; readonly output: z.ZodObject<{ order: z.ZodObject<{ id: z.ZodString; number: z.ZodNumber; facility: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; customer: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; kind: z.ZodString; title: z.ZodString; description: z.ZodNullable; status: z.ZodEnum<{ closed: "closed"; completed: "completed"; in_progress: "in_progress"; planned: "planned"; }>; assignedTo: z.ZodNullable; createdBy: z.ZodString; createdAt: z.ZodString; completedAt: z.ZodNullable; }, z.core.$strip>; time: z.ZodArray; reported_at: z.ZodString; }, z.core.$strip>>; material: z.ZodArray; reported_by: z.ZodString; reported_at: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>; }; readonly 'workorder/list': { readonly summary: "Work orders, newest first, optionally filtered by status"; readonly permission: "workorder:read"; readonly input: z.ZodObject<{ status: z.ZodOptional; }, z.core.$strip>; readonly inputOptional: true; readonly output: z.ZodObject<{ id: z.ZodString; number: z.ZodNumber; facility: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; customer: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; kind: z.ZodString; title: z.ZodString; description: z.ZodNullable; status: z.ZodEnum<{ closed: "closed"; completed: "completed"; in_progress: "in_progress"; planned: "planned"; }>; assignedTo: z.ZodNullable; createdBy: z.ZodString; createdAt: z.ZodString; completedAt: z.ZodNullable; }, z.core.$strip>; readonly paged: { readonly over: { readonly entity: "workorder"; readonly sortable: readonly ["number", "status", "created_at"]; readonly filterable: readonly ["status", "assigned_to", "kind"]; }; readonly order: "desc"; }; }; readonly 'workorder/assign': { readonly summary: "Assign a technician"; readonly permission: "workorder:assign"; readonly input: z.ZodObject<{ orderId: z.ZodString; technician: z.ZodString; }, z.core.$strip>; readonly output: z.ZodObject<{ id: z.ZodString; number: z.ZodNumber; facility: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; customer: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; kind: z.ZodString; title: z.ZodString; description: z.ZodNullable; status: z.ZodEnum<{ closed: "closed"; completed: "completed"; in_progress: "in_progress"; planned: "planned"; }>; assignedTo: z.ZodNullable; createdBy: z.ZodString; createdAt: z.ZodString; completedAt: z.ZodNullable; }, z.core.$strip>; }; readonly 'workorder/start': { readonly summary: "Start the work"; readonly permission: "workorder:report"; readonly input: z.ZodObject<{ orderId: z.ZodString; }, z.core.$strip>; readonly output: z.ZodObject<{ id: z.ZodString; number: z.ZodNumber; facility: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; customer: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; kind: z.ZodString; title: z.ZodString; description: z.ZodNullable; status: z.ZodEnum<{ closed: "closed"; completed: "completed"; in_progress: "in_progress"; planned: "planned"; }>; assignedTo: z.ZodNullable; createdBy: z.ZodString; createdAt: z.ZodString; completedAt: z.ZodNullable; }, z.core.$strip>; }; readonly 'workorder/report-time': { readonly summary: "Report time against the order"; readonly permission: "workorder:report"; readonly input: z.ZodObject<{ orderId: z.ZodString; hours: z.ZodString; note: z.ZodOptional; }, z.core.$strip>; readonly output: z.ZodObject<{ id: z.ZodString; order_id: z.ZodString; technician: z.ZodString; hours: z.ZodString; note: z.ZodNullable; reported_at: z.ZodString; }, z.core.$strip>; }; readonly 'workorder/report-material': { readonly summary: "Report material against the order"; readonly permission: "workorder:report"; readonly input: z.ZodObject<{ orderId: z.ZodString; article: z.ZodString; qty: z.ZodString; note: z.ZodOptional; }, z.core.$strip>; readonly output: z.ZodObject<{ id: z.ZodString; order_id: z.ZodString; article: z.ZodString; qty: z.ZodString; note: z.ZodNullable; reported_by: z.ZodString; reported_at: z.ZodString; }, z.core.$strip>; }; readonly 'workorder/complete': { readonly summary: "Complete the order with its billable lines"; readonly permission: "workorder:complete"; readonly input: z.ZodObject<{ orderId: z.ZodString; billable: z.ZodArray; currency: z.core.$ZodBranded; }, z.core.$strip>; lineTotal: z.ZodObject<{ amount: z.core.$ZodBranded; currency: z.core.$ZodBranded; }, z.core.$strip>; sourceType: z.ZodEnum<{ material: "material"; time: "time"; }>; sourceId: z.ZodString; }, z.core.$strip>>; currency: z.ZodOptional>; }, z.core.$strip>; readonly output: z.ZodObject<{ order: z.ZodObject<{ id: z.ZodString; number: z.ZodNumber; facility: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; customer: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; kind: z.ZodString; title: z.ZodString; description: z.ZodNullable; status: z.ZodEnum<{ closed: "closed"; completed: "completed"; in_progress: "in_progress"; planned: "planned"; }>; assignedTo: z.ZodNullable; createdBy: z.ZodString; createdAt: z.ZodString; completedAt: z.ZodNullable; }, z.core.$strip>; total: z.ZodObject<{ amount: z.core.$ZodBranded; currency: z.core.$ZodBranded; }, z.core.$strip>; }, z.core.$strip>; }; readonly 'workorder/close': { readonly summary: "Close the order at hand-over"; readonly permission: "workorder:close"; readonly input: z.ZodObject<{ orderId: z.ZodString; }, z.core.$strip>; readonly output: z.ZodObject<{ id: z.ZodString; number: z.ZodNumber; facility: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; customer: z.ZodObject<{ entityType: z.ZodString; entityId: z.ZodString; }, z.core.$strip>; kind: z.ZodString; title: z.ZodString; description: z.ZodNullable; status: z.ZodEnum<{ closed: "closed"; completed: "completed"; in_progress: "in_progress"; planned: "planned"; }>; assignedTo: z.ZodNullable; createdBy: z.ZodString; createdAt: z.ZodString; completedAt: z.ZodNullable; }, z.core.$strip>; }; }; //# sourceMappingURL=operations.d.ts.map