{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cementops.io/schemas/safety-observation.schema.json",
  "title": "Safety Observation",
  "description": "Structured record for an observed safety-relevant condition, near-miss note, or housekeeping/access/guarding/dust/traffic/energy-isolation concern, plus its routing status. Observational and advisory only: it records what was seen and where it was routed. It authorizes no corrective action, field work, operation, shutdown, restart, LOTO decision, safety clearance, environmental/compliance conclusion, or legal determination, and it carries no numeric criteria.",
  "type": "object",
  "version": "0.1.0",
  "required": ["observedAt", "reportedBy", "area", "observationType", "observationSummary", "safetyStatus", "immediateRouting", "authorityLimits", "notAuthorizationStatement"],
  "additionalProperties": false,
  "properties": {
    "observationId": {
      "type": "string",
      "description": "Optional unique identifier for this observation record."
    },
    "observedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the condition was observed (ISO 8601)."
    },
    "reportedBy": {
      "type": "string",
      "description": "Name or role of the person who made the observation."
    },
    "area": {
      "type": "string",
      "description": "Plant area where the condition was observed.",
      "enum": ["quarry", "crusher", "raw-mill", "kiln", "cooler", "finish-mill", "packing", "utilities", "lab", "maintenance-shop", "traffic-area", "other", "unknown"]
    },
    "equipmentOrLocation": {
      "type": "string",
      "description": "Specific equipment, functional location, or spot, if known."
    },
    "observationType": {
      "type": "string",
      "description": "Category of the observation (a routing label, not a determination).",
      "enum": ["housekeeping", "guarding", "access-egress", "dust", "heat", "traffic", "energy-isolation-concern", "ppe", "near-miss", "equipment-condition", "environmental", "other"]
    },
    "observationSummary": {
      "type": "string",
      "description": "Short, neutral description of what was observed. Description, not diagnosis, and no numeric values."
    },
    "safetyStatus": {
      "type": "string",
      "description": "Routing status for the observation, never a safety clearance. The record never declares a condition safe; it only notes that this is an observation, or that a concern / imminent hazard was routed to human authority.",
      "enum": ["observation-only", "possible-concern-routed-to-authority", "imminent-hazard-routed-to-emergency-procedure"]
    },
    "immediateRouting": {
      "type": "string",
      "description": "Where the observation is routed first. A routing destination to a human/authority, not an instruction to act.",
      "enum": ["site-safety-authority", "site-emergency-procedure", "supervisor", "maintenance-reliability", "environmental-authority", "human-classification"]
    },
    "relatedIssue": {
      "type": "string",
      "description": "Optional reference (id or site path) to a related plant-issue-intake record."
    },
    "relatedHandover": {
      "type": "string",
      "description": "Optional reference (id or site path) to a related shift-handover record."
    },
    "evidenceAvailable": {
      "type": "array",
      "description": "Qualitative list of supporting evidence the reporter can supply (e.g. 'photo', 'location note'). No numeric measurements.",
      "items": { "type": "string" },
      "default": []
    },
    "missingInformation": {
      "type": "array",
      "description": "Explicit questions or details still needed for the authority to assess. Ask, do not assume.",
      "items": { "type": "string" },
      "default": []
    },
    "routedTo": {
      "type": "array",
      "description": "Roles/authorities or site paths the observation was routed to for review.",
      "items": { "type": "string" },
      "default": []
    },
    "followUpOwner": {
      "type": "string",
      "description": "The role/authority who owns any follow-up decision. The record does not own the decision."
    },
    "authorityLimits": {
      "type": "array",
      "description": "Explicit statements of what this record does NOT authorize (corrective action, field work, operation, shutdown, restart, LOTO decision, safety clearance, environmental/compliance conclusion, legal determination).",
      "items": { "type": "string" },
      "default": []
    },
    "notAuthorizationStatement": {
      "type": "string",
      "description": "A required, explicit statement that this observation record is advisory only and authorizes nothing; any safety decision or action requires the appropriate human authority under site procedure."
    }
  }
}
