{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openssom.org/schema/profile-origin-free-outcome.json",
  "title": "SSOM Origin-free Operating History Profile: Outcome",
  "description": "DRAFT (RFC-0004). An Outcome as released with an origin-free release: what was intended and what was observed after work on a kind of asset, each as a governed code with an optional metric and number. It has no place for a sentence, a cost, a person or a commercial result. Unknown properties are rejected.",
  "allOf": [
    {
      "$ref": "outcome.json"
    }
  ],
  "type": "object",
  "required": [
    "outcome_id",
    "semantic_truth_state",
    "ssom_version",
    "outcome_type",
    "subject_ref",
    "intended_outcome",
    "observed_outcome",
    "assessed_at",
    "evidence_refs",
    "confidence",
    "provenance",
    "temporal_integrity"
  ],
  "properties": {
    "outcome_id": {
      "type": "string",
      "pattern": "^urn:ssom:outcome:tok:[0-9a-f]{32,64}$"
    },
    "semantic_truth_state": {
      "const": "outcome"
    },
    "ssom_version": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
    },
    "outcome_type": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]*$"
    },
    "subject_ref": {
      "type": "string",
      "pattern": "^urn:ssom:asset:tok:[0-9a-f]{32,64}$"
    },
    "action_ref": {
      "type": "string",
      "pattern": "^urn:ssom:action:tok:[0-9a-f]{32,64}$"
    },
    "intended_outcome": {
      "type": "object",
      "required": [
        "description"
      ],
      "properties": {
        "description": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*$",
          "description": "A governed code of the shared vocabulary in the place where the core record holds a sentence."
        },
        "target_metric": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*$"
        },
        "target_value": {
          "type": "number"
        },
        "unit": {
          "type": "string",
          "pattern": "^[A-Z][A-Z0-9_]*$"
        }
      },
      "additionalProperties": false
    },
    "observed_outcome": {
      "type": "object",
      "required": [
        "description"
      ],
      "properties": {
        "description": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*$",
          "description": "A governed code of the shared vocabulary in the place where the core record holds a sentence."
        },
        "result_class": {},
        "measured_metric": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]*$"
        },
        "measured_value": {
          "type": "number"
        },
        "unit": {
          "type": "string",
          "pattern": "^[A-Z][A-Z0-9_]*$"
        }
      },
      "additionalProperties": false
    },
    "assessed_at": {
      "type": "string",
      "format": "date-time"
    },
    "evidence_refs": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^urn:ssom:(record|alarm|failure-event|action):tok:[0-9a-f]{32,64}$"
      }
    },
    "confidence": {
      "type": "number"
    },
    "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
}
