{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openssom.org/schema/profile-origin-free-action.json",
  "title": "SSOM Origin-free Operating History Profile: Work Done",
  "description": "DRAFT (RFC-0004). Work done on a kind of asset, as released with an origin-free release: a closed form of the core Action with a governed kind of work, the asset it was done to, its status, its time and what it answered. It has no place for who did the work, a note, a part number, labour, a cost, a work request or a work plan. Unknown properties are rejected.",
  "allOf": [
    {
      "$ref": "action.json"
    }
  ],
  "type": "object",
  "required": [
    "action_id",
    "semantic_truth_state",
    "ssom_version",
    "action_type",
    "target_ref",
    "action_status",
    "basis_refs",
    "executed_at",
    "provenance",
    "temporal_integrity"
  ],
  "properties": {
    "action_id": {
      "type": "string",
      "pattern": "^urn:ssom:action:tok:[0-9a-f]{32,64}$"
    },
    "semantic_truth_state": {
      "const": "action"
    },
    "ssom_version": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
    },
    "action_type": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]*$"
    },
    "target_ref": {
      "type": "string",
      "pattern": "^urn:ssom:asset:tok:[0-9a-f]{32,64}$"
    },
    "action_status": {},
    "basis_refs": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^urn:ssom:(record|alarm|failure-event):tok:[0-9a-f]{32,64}$"
      }
    },
    "executed_at": {
      "type": "string",
      "format": "date-time"
    },
    "provenance": {
      "type": "object",
      "required": [
        "source_platform",
        "source_authority_id",
        "source_reference",
        "lineage_id",
        "ingest_time",
        "processing_time",
        "mapping_package_id",
        "mapping_version"
      ],
      "properties": {
        "source_platform": {
          "const": "origin_free_release"
        },
        "source_authority_id": {
          "type": "string",
          "pattern": "^urn:ssom:release:tok:[0-9a-f]{32,64}$"
        },
        "source_reference": {
          "type": "string",
          "pattern": "^urn:ssom:(record|alarm|failure-event|action|outcome|episode|signal|asset|relationship):tok:[0-9a-f]{32,64}$"
        },
        "lineage_id": {
          "type": "string",
          "pattern": "^urn:ssom:(record|alarm|failure-event|action|outcome|episode|signal|asset|relationship):tok:[0-9a-f]{32,64}$"
        },
        "ingest_time": {
          "type": "string",
          "format": "date-time"
        },
        "processing_time": {
          "type": "string",
          "format": "date-time"
        },
        "mapping_package_id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "mapping_version": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
        }
      },
      "additionalProperties": false
    },
    "temporal_integrity": {
      "type": "object",
      "required": [
        "event_time",
        "receive_time",
        "processing_time",
        "delivery_classification"
      ],
      "properties": {
        "event_time": {
          "type": "string",
          "format": "date-time"
        },
        "receive_time": {
          "type": "string",
          "format": "date-time"
        },
        "processing_time": {
          "type": "string",
          "format": "date-time"
        },
        "delivery_classification": {
          "const": "replay"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
