{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/daon/json-schema/daon-abstract-trend-record-dto-schema.json",
  "title": "AbstractTrendRecordDto",
  "description": "Base class for trend records with common metadata fields",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/daon-trends-api-openapi.yml#/components/schemas/AbstractTrendRecordDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the trend record",
      "readOnly": true
    },
    "type": {
      "type": "string",
      "description": "Type of the trend record (determines which specific fields are available)",
      "minLength": 1
    },
    "recordedDtm": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the occurrence was recorded (generated on storage)",
      "readOnly": true
    },
    "processInfo": {
      "$ref": "#/$defs/ProcessInfoDto",
      "description": "Process information associated with this trend record"
    },
    "trendGroup": {
      "type": "string",
      "description": "Optional trend group for grouping trends by business context",
      "maxLength": 32,
      "minLength": 0,
      "pattern": "^[a-zA-Z0-9_]+$"
    },
    "expiresAfter": {
      "type": "string",
      "format": "date-time",
      "description": "The calculated expiration timestamp (recordedDtm + expiresAfterDays)",
      "readOnly": true
    },
    "expiresAfterDays": {
      "type": "integer",
      "format": "int32",
      "description": "The number of days after which the record will expire",
      "minimum": 1
    },
    "attributes": {
      "type": "object",
      "additionalProperties": {},
      "description": "Optional additional attributes for the trend record"
    },
    "value": {
      "type": "string"
    }
  },
  "required": [
    "processInfo",
    "type"
  ],
  "$defs": {
    "ProcessInfoDto": {
      "type": "object",
      "description": "Process information associated with a watchlist entry or trend record",
      "properties": {
        "processDefnId": {
          "type": "string",
          "description": "Unique identifier for the process definition",
          "maxLength": 26,
          "minLength": 26
        },
        "processDefnName": {
          "type": "string",
          "description": "Human-readable name of the process definition",
          "maxLength": 50,
          "minLength": 0
        },
        "processDefnVersion": {
          "type": "integer",
          "format": "int32",
          "description": "Version number of the process definition",
          "minimum": 1
        },
        "processInstanceId": {
          "type": "string",
          "description": "Unique identifier for the process instance",
          "maxLength": 26,
          "minLength": 26
        }
      },
      "required": [
        "processDefnId",
        "processDefnName",
        "processDefnVersion",
        "processInstanceId"
      ]
    }
  }
}