state definitions

This commit is contained in:
Marcelo
2026-05-02 01:35:27 +00:00
parent 4299ef3478
commit 0491237bad
16 changed files with 2887 additions and 43 deletions

View File

@@ -121,7 +121,24 @@ export type RecapQuery = {
shift?: string;
};
export type RecapMachineStatus = "running" | "mold-change" | "stopped" | "offline";
export type RecapMachineStatus = "running" | "mold-change" | "stopped" | "data-loss" | "offline" | "idle";
export type RecapStoppedReason = "machine_fault" | "not_started";
export type RecapDataLossReason = "untracked";
/**
* Reason context for STOPPED and DATA_LOSS states.
* - When status is "stopped": stoppedReason is set, dataLossReason is null.
* - When status is "data-loss": dataLossReason is set, stoppedReason is null.
* - All other states: both are null.
*/
export type RecapStateContext = {
stoppedReason: RecapStoppedReason | null;
dataLossReason: RecapDataLossReason | null;
/** For data-loss: how many untracked cycles have been detected so far. */
untrackedCycleCount: number | null;
};
export type RecapSummaryMachine = {
machineId: string;
@@ -136,6 +153,7 @@ export type RecapSummaryMachine = {
lastActivityMin: number | null;
offlineForMin: number | null;
ongoingStopMin: number | null;
stateContext: RecapStateContext;
activeWorkOrderId: string | null;
moldChange: {
active: boolean;
@@ -193,6 +211,7 @@ export type RecapMachineDetail = {
lastSeenMs: number | null;
offlineForMin: number | null;
ongoingStopMin: number | null;
stateContext: RecapStateContext;
moldChange: {
active: boolean;
startMs: number | null;