{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cementops.io/schemas/shift-handover.schema.json",
  "title": "Shift Handover",
  "description": "Structured record one shift hands forward to the next: qualitative equipment status, open issues, work in progress, watch items, and what is pending for authorized personnel. Capture and carry-forward only; it records status and routes what is pending — it authorizes no operation, adjustment, release, or field work, and contains no numeric criteria.",
  "type": "object",
  "version": "0.1.0",
  "required": ["shift", "observedAt", "preparedBy", "authorityLimits", "notAuthorizationStatement"],
  "additionalProperties": false,
  "properties": {
    "handoverId": {
      "type": "string",
      "description": "Optional unique identifier for this handover record."
    },
    "shift": {
      "type": "string",
      "description": "The outgoing shift this record hands forward from.",
      "enum": ["day", "swing", "night", "unknown"]
    },
    "observedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When this handover was prepared (ISO 8601)."
    },
    "preparedBy": {
      "type": "string",
      "description": "Name or role of the person on the outgoing shift who prepared the handover."
    },
    "areas": {
      "type": "array",
      "description": "Plant areas in scope for this handover.",
      "items": {
        "type": "string",
        "enum": ["quarry", "crusher", "raw-mill", "kiln", "cooler", "finish-mill", "packing", "utilities", "lab", "other"]
      },
      "default": []
    },
    "equipmentStatusNotes": {
      "type": "array",
      "description": "Qualitative status of equipment for the next shift's awareness (e.g. 'running', 'down for maintenance', 'standby'). Status words only — no setpoints, rates, temperatures, or other numeric values.",
      "items": { "type": "string" },
      "default": []
    },
    "openIssues": {
      "type": "array",
      "description": "Issues carried forward to the next shift. Each is a neutral status record, not an instruction.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["summary", "status"],
        "properties": {
          "summary": {
            "type": "string",
            "description": "Short, neutral restatement of the open issue. Description, not diagnosis."
          },
          "status": {
            "type": "string",
            "description": "Where the issue stands as it is handed across (qualitative; never a safety or compliance clearance).",
            "enum": ["monitoring", "handed-off", "escalated", "resolved-pending-verification"]
          },
          "see": {
            "type": "string",
            "description": "Optional site path to the relevant page, schema, or template."
          }
        }
      },
      "default": []
    },
    "inProgressWork": {
      "type": "array",
      "description": "Work underway at handover, described for awareness. Descriptive only — not instructions to operate, adjust, or perform field work.",
      "items": { "type": "string" },
      "default": []
    },
    "watchItems": {
      "type": "array",
      "description": "Things for the next shift to keep an eye on. Observational only; any response belongs to authorized personnel under site procedure.",
      "items": { "type": "string" },
      "default": []
    },
    "safetyEnvironmentalNotes": {
      "type": "array",
      "description": "Safety- or environmental-relevant notes to route to the appropriate authority. Records that a note exists and where it is routed; it is never a safety or compliance determination.",
      "items": { "type": "string" },
      "default": []
    },
    "pendingForAuthorizedPersonnel": {
      "type": "array",
      "description": "Decisions or actions that are owned by authorized humans under site procedure (operation, adjustment, release/hold, maintenance, environmental, safety). Recorded as pending — not instructions to the next shift.",
      "items": { "type": "string" },
      "default": []
    },
    "authorityLimits": {
      "type": "array",
      "description": "Explicit statements of what this record does NOT authorize (operation, shutdown, restart, control change, field work, product release/hold/reject, environmental determination, maintenance action, safety decision).",
      "items": { "type": "string" },
      "default": []
    },
    "notAuthorizationStatement": {
      "type": "string",
      "description": "A required, explicit statement that this handover is advisory and informational only and authorizes nothing; any action requires the appropriate human authority under site procedure."
    }
  }
}
