{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/daon/json-schema/daon-email-trend-record-dto-schema.json",
  "title": "EmailTrendRecordDto",
  "description": "Trend record for email address occurrences",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/daon-trends-api-openapi.yml#/components/schemas/EmailTrendRecordDto",
  "allOf": [
    {
      "$ref": "#/$defs/AbstractTrendRecordDto"
    },
    {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "description": "The email address value being recorded. On input, this is the original value which will be normalized. On output, this is the normalized value.",
          "maxLength": 254,
          "minLength": 0
        },
        "originalValue": {
          "type": "string",
          "description": "The original email address value before normalization",
          "maxLength": 254,
          "minLength": 0,
          "readOnly": true
        }
      }
    }
  ],
  "required": [
    "processInfo",
    "type",
    "value"
  ],
  "$defs": {
    "AbstractTrendRecordDto": {
      "type": "object",
      "description": "Base class for trend records with common metadata fields",
      "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"
      ]
    },
    "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"
      ]
    }
  }
}