{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agstack/json-schema/agstack-alert-schema.json",
  "title": "Alert",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agstack-alerts-api-openapi.yml#/components/schemas/Alert",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "activityType": {
      "type": "string",
      "format": "uuid"
    },
    "title": {
      "type": "string",
      "maxLength": 200
    },
    "details": {
      "type": [
        "string",
        "null"
      ]
    },
    "severity": {
      "$ref": "#/$defs/SeverityEnum"
    },
    "hasAgriParcel": {
      "type": "string",
      "format": "uuid"
    },
    "validFrom": {
      "type": "string",
      "format": "date-time"
    },
    "validTo": {
      "type": "string",
      "format": "date-time"
    },
    "dateIssued": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true
    },
    "quantityValue": {
      "$ref": "#/$defs/ObservationQuantityValueField"
    },
    "relatedObservation": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    }
  },
  "required": [
    "activityType",
    "dateIssued",
    "hasAgriParcel",
    "id",
    "relatedObservation",
    "validFrom",
    "validTo"
  ],
  "$defs": {
    "ObservationQuantityValueField": {
      "type": "object",
      "properties": {
        "unit": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "hasValue": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        }
      },
      "required": [
        "hasValue",
        "unit"
      ]
    },
    "SeverityEnum": {
      "enum": [
        "minor",
        "moderate",
        "severe",
        "major",
        "critical"
      ],
      "type": "string",
      "description": "* `minor` - Minor\n* `moderate` - Moderate\n* `severe` - Severe\n* `major` - Major\n* `critical` - Critical"
    }
  }
}