{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/monit-rs/json-schema/monit-rs-incident-ingest-request-schema.json",
  "title": "IncidentIngestRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/monit-rs-ingestion-api-openapi.yml#/components/schemas/IncidentIngestRequest",
  "type": "object",
  "required": [
    "action",
    "dedup_key",
    "payload"
  ],
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "trigger",
        "acknowledge",
        "resolve"
      ]
    },
    "dedup_key": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Merges trigger/ack/resolve events into one incident (PagerDuty pattern)."
    },
    "endpoint_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Required on trigger; optional on ack/resolve."
    },
    "external_ref": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255,
      "description": "Free-form caller-side reference (e.g. ticket number)."
    },
    "payload": {
      "$ref": "#/$defs/IncidentPayload"
    }
  },
  "$defs": {
    "IncidentPayload": {
      "type": "object",
      "required": [
        "title",
        "severity"
      ],
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "severity": {
          "type": "string",
          "enum": [
            "critical",
            "error",
            "warning",
            "info"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}