watchAssignmentMachine
@mineflow/api-schemas / watchAssignmentMachine
Variable: watchAssignmentMachine
const watchAssignmentMachine: StateMachine<WatchAssignmentContext,
| {
actorId: string;
type: "ARRIVE";
}
| {
actorId: string;
type: "DEPART";
}
| {
actorId: string;
reason?: string;
type: "CANCEL";
}, {
}, never, never, never, never, "scheduled" | "completed" | "cancelled" | "active", string, NonReducibleUnknown, NonReducibleUnknown, EventObject, MetaObject, ToStateSchema<{
context: {
watchAssignmentId: "";
};
id: "watchAssignment";
initial: "scheduled";
states: {
active: {
on: {
DEPART: "completed";
};
};
cancelled: {
type: "final";
};
completed: {
type: "final";
};
scheduled: {
on: {
ARRIVE: "active";
CANCEL: "cancelled";
};
};
};
}>>;
Defined in: hr/src/watches/state-machine/watch-assignment.machine.ts:23
FSM вахтового назначения сотрудника (HR WatchAssignment) — заезд на вахту, присутствие и отъезд.
Источник истины — entity (ADR-0022); машина — spec для exhaustive coverage
переходов в тестах. Re-export'ится @mineflow/api-schemas для FSM-кнопок в UI.
Состояния и переходы:
scheduled(начальное) →ARRIVE→active(заезд)scheduled→CANCEL→cancelled(отмена назначения)active→DEPART→completed(отъезд)completed,cancelled— терминальные состояния.