{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://servicenow.com/schemas/servicenow/incident.json",
  "title": "ServiceNow Incident",
  "description": "A ServiceNow incident record used for tracking disruptions to IT services, reporting issues, and managing resolution workflows within IT Service Management.",
  "type": "object",
  "required": ["sys_id", "number", "short_description", "state"],
  "properties": {
    "sys_id": {
      "type": "string",
      "pattern": "^[a-f0-9]{32}$",
      "description": "The unique 32-character system identifier for the incident record."
    },
    "number": {
      "type": "string",
      "pattern": "^INC[0-9]+$",
      "description": "The human-readable incident number, prefixed with INC."
    },
    "short_description": {
      "type": "string",
      "maxLength": 160,
      "description": "A brief summary of the incident used as the primary display title."
    },
    "description": {
      "type": ["string", "null"],
      "description": "A detailed description of the incident including symptoms and impact."
    },
    "state": {
      "type": "string",
      "enum": ["1", "2", "3", "6", "7", "8"],
      "description": "The current state of the incident: 1=New, 2=In Progress, 3=On Hold, 6=Resolved, 7=Closed, 8=Canceled."
    },
    "impact": {
      "type": "string",
      "enum": ["1", "2", "3"],
      "description": "The impact level: 1=High, 2=Medium, 3=Low."
    },
    "urgency": {
      "type": "string",
      "enum": ["1", "2", "3"],
      "description": "The urgency level: 1=High, 2=Medium, 3=Low."
    },
    "priority": {
      "type": "string",
      "enum": ["1", "2", "3", "4", "5"],
      "description": "The calculated priority: 1=Critical, 2=High, 3=Moderate, 4=Low, 5=Planning."
    },
    "severity": {
      "type": "string",
      "enum": ["1", "2", "3"],
      "description": "The severity level: 1=High, 2=Medium, 3=Low."
    },
    "category": {
      "type": ["string", "null"],
      "description": "The category of the incident, such as Inquiry, Software, Hardware, or Network."
    },
    "subcategory": {
      "type": ["string", "null"],
      "description": "The subcategory providing further classification within the category."
    },
    "contact_type": {
      "type": ["string", "null"],
      "description": "The method through which the incident was reported, such as phone, email, or self-service."
    },
    "caller_id": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The user who reported the incident."
    },
    "assigned_to": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The user assigned to work on the incident."
    },
    "assignment_group": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The group responsible for resolving the incident."
    },
    "opened_by": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The user who created the incident record."
    },
    "opened_at": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the incident was opened."
    },
    "resolved_by": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The user who resolved the incident."
    },
    "resolved_at": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "The date and time the incident was resolved."
    },
    "closed_by": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The user who closed the incident."
    },
    "closed_at": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "The date and time the incident was closed."
    },
    "close_code": {
      "type": ["string", "null"],
      "description": "The code indicating how the incident was resolved."
    },
    "close_notes": {
      "type": ["string", "null"],
      "description": "Notes recorded at the time of resolution or closure."
    },
    "cmdb_ci": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The configuration item affected by the incident."
    },
    "business_service": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The business service impacted by the incident."
    },
    "company": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The company associated with the incident."
    },
    "location": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The location associated with the incident."
    },
    "notify": {
      "type": "string",
      "enum": ["1", "2", "3"],
      "description": "Notification preference: 1=Do Not Notify, 2=Send Notifications, 3=Send Notifications for state changes."
    },
    "work_notes": {
      "type": ["string", "null"],
      "description": "Internal work notes visible only to the fulfillment team."
    },
    "comments": {
      "type": ["string", "null"],
      "description": "Additional comments visible to the caller."
    },
    "reopen_count": {
      "type": "integer",
      "minimum": 0,
      "description": "The number of times the incident has been reopened."
    },
    "reassignment_count": {
      "type": "integer",
      "minimum": 0,
      "description": "The number of times the incident has been reassigned."
    },
    "escalation": {
      "type": "string",
      "enum": ["0", "1", "2", "3"],
      "description": "The escalation level: 0=Normal, 1=Overdue, 2=Moderate, 3=High."
    },
    "upon_reject": {
      "type": ["string", "null"],
      "description": "Action to take when an approval is rejected."
    },
    "upon_approval": {
      "type": ["string", "null"],
      "description": "Action to take when an approval is granted."
    },
    "active": {
      "type": "boolean",
      "description": "Whether the incident record is active."
    },
    "knowledge": {
      "type": "boolean",
      "description": "Whether the incident has been flagged as a knowledge candidate."
    },
    "made_sla": {
      "type": "boolean",
      "description": "Whether the incident resolution met the SLA target."
    },
    "sys_created_on": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the record was created."
    },
    "sys_created_by": {
      "type": "string",
      "description": "The user who created the record."
    },
    "sys_updated_on": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time the record was last updated."
    },
    "sys_updated_by": {
      "type": "string",
      "description": "The user who last updated the record."
    },
    "sys_mod_count": {
      "type": "integer",
      "minimum": 0,
      "description": "The number of times the record has been modified."
    },
    "sys_class_name": {
      "type": "string",
      "description": "The table class name for the record."
    },
    "sys_domain": {
      "$ref": "#/$defs/ReferenceField",
      "description": "The domain of the record."
    }
  },
  "$defs": {
    "ReferenceField": {
      "type": ["object", "string", "null"],
      "description": "A ServiceNow reference field that can be a sys_id string or an object containing a link and value.",
      "properties": {
        "link": {
          "type": "string",
          "format": "uri",
          "description": "The API URL to the referenced record."
        },
        "value": {
          "type": "string",
          "description": "The sys_id of the referenced record."
        },
        "display_value": {
          "type": "string",
          "description": "The display value of the referenced record."
        }
      }
    }
  }
}
