{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/daon/json-schema/daon-phone-number-trend-record-dto-schema.json",
  "title": "PhoneNumberTrendRecordDto",
  "description": "Trend record for phone number 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/PhoneNumberTrendRecordDto",
  "allOf": [
    {
      "$ref": "#/$defs/AbstractTrendRecordDto"
    },
    {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "description": "The phone number value being recorded. On input, this is the original value which will be normalized to E.164 format. On output, this is the normalized value in E.164 format.",
          "maxLength": 24,
          "minLength": 0
        },
        "originalValue": {
          "type": "string",
          "description": "The original phone number value before normalization",
          "maxLength": 40,
          "minLength": 0,
          "readOnly": true
        },
        "region": {
          "type": "string",
          "description": "Optional region/country code for normalizing the phone number (e.g. US, GB). If not supplied, the tenant's default region is used.",
          "maxLength": 10,
          "minLength": 0,
          "writeOnly": 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"
      ]
    }
  }
}