{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.ectropy.ai/flow/intake/labor-time-intake.schema.json",
  "title": "Labour Time Intake (HSx)",
  "version": "0.3.0",
  "description": "Hours worked by a pseudonymous worker on a work date, as a subcontractor, crew app or time clock reports them. No money and no identity: a workerRef, the employer of record, the classification, the place and the takt. Every instance must also validate against GS1's EPCIS 2.0.1 JSON Schema; this profile only narrows it. Closed at the top level: only the EPCIS 2.0 fields a labour-time observation uses, @context, eventID, errorDeclaration, ectropy:source and ectropy:labor are admitted; any other key -- a rate, a pay amount, an unrelated extension -- is refused, so neither money nor identity can ride on a labour-time event.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/epcisEventCore"
    },
    {
      "propertyNames": {
        "enum": [
          "@context",
          "type",
          "eventID",
          "eventTime",
          "recordTime",
          "eventTimeZoneOffset",
          "errorDeclaration",
          "epcList",
          "action",
          "bizStep",
          "disposition",
          "readPoint",
          "bizLocation",
          "ectropy:source",
          "ectropy:labor"
        ]
      },
      "properties": {
        "type": {
          "enum": [
            "ObjectEvent"
          ]
        },
        "bizStep": {
          "enum": [
            "other"
          ]
        },
        "ectropy:labor": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "workerRef",
            "employerRef",
            "classificationRef",
            "workDate",
            "hours"
          ],
          "properties": {
            "workerRef": {
              "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/workerRef"
            },
            "employerRef": {
              "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/partyUri"
            },
            "classificationRef": {
              "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/partyUri"
            },
            "workDate": {
              "type": "string",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
            },
            "hours": {
              "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/hours"
            },
            "apprentice": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "registered": {
                  "type": "boolean"
                },
                "level": {
                  "type": "string"
                }
              }
            },
            "attestation": {
              "enum": [
                "observed",
                "attested"
              ]
            },
            "takt": {
              "$ref": "https://schemas.ectropy.ai/flow/flow-common.schema.json#/definitions/taktRef"
            },
            "costCode": {
              "type": "string"
            },
            "sovLine": {
              "type": "string"
            }
          }
        }
      },
      "required": [
        "ectropy:labor"
      ]
    }
  ]
}
