{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openssom.org/schema/profile-origin-free-alarm.json",
  "title": "SSOM Origin-free Operating History Profile: Alarm",
  "description": "DRAFT (RFC-0004). An Alarm as released with an origin-free release: what was raised on a kind of asset, when, and against which limit. It has no place for a source system, a tag, a person, a comment, an acknowledgement or shelving history, or any text. Unknown properties are rejected.",
  "allOf": [
    {
      "$ref": "alarm.json"
    }
  ],
  "type": "object",
  "required": [
    "alarm_id",
    "semantic_truth_state",
    "ssom_version",
    "subject_ref",
    "alarm_type",
    "alarm_state",
    "raised_at",
    "derivation_type",
    "provenance",
    "temporal_integrity"
  ],
  "properties": {
    "alarm_id": {
      "type": "string",
      "pattern": "^urn:ssom:alarm:tok:[0-9a-f]{32,64}$"
    },
    "semantic_truth_state": {
      "const": "alarm"
    },
    "ssom_version": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
    },
    "subject_ref": {
      "type": "string",
      "pattern": "^urn:ssom:asset:tok:[0-9a-f]{32,64}$"
    },
    "alarm_type": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]*$"
    },
    "alarm_state": {},
    "raised_at": {
      "type": "string",
      "format": "date-time"
    },
    "cleared_at": {
      "type": "string",
      "format": "date-time"
    },
    "priority": {},
    "derivation_type": {},
    "observation_ref": {
      "type": "string",
      "pattern": "^urn:ssom:record:tok:[0-9a-f]{32,64}$"
    },
    "threshold": {
      "type": "object",
      "required": [
        "threshold_type",
        "threshold_value"
      ],
      "properties": {
        "threshold_type": {},
        "threshold_value": {
          "type": "number"
        },
        "unit": {
          "type": "object",
          "required": [
            "unit_code",
            "vocabulary_id"
          ],
          "properties": {
            "unit_code": {
              "type": "string",
              "pattern": "^[A-Z][A-Z0-9_]*$"
            },
            "vocabulary_id": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          "additionalProperties": false
        },
        "persistence_duration": {
          "type": "string",
          "pattern": "^P"
        }
      },
      "additionalProperties": false
    },
    "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
}
