{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eagle-eye-networks/json-schema/eagle-eye-networks-audit-events-schema.json",
  "title": "AuditEvents",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eagle-eye-networks-auditlog-api-openapi.yml#/components/schemas/AuditEvents",
  "allOf": [
    {
      "$ref": "#/$defs/PaginatedResponseNoTotalSize"
    },
    {
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AuditEvent"
          }
        }
      }
    }
  ],
  "$defs": {
    "AuditEvent": {
      "allOf": [
        {
          "$ref": "#/$defs/CreateAuditEvent"
        }
      ],
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "ipAddressLocation": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            },
            "region": {
              "type": "string"
            },
            "zipCode": {
              "type": "string"
            },
            "country": {
              "type": "string"
            }
          }
        },
        "description": {
          "type": "string"
        },
        "auditTypeName": {
          "type": "string"
        }
      }
    },
    "CreateAuditEvent": {
      "type": "object",
      "required": [
        "userId",
        "accountId",
        "auditType",
        "targetType",
        "targetId",
        "targetName"
      ],
      "properties": {
        "timestamp": {
          "$ref": "#/$defs/timestamp"
        },
        "userId": {
          "$ref": "#/$defs/userId"
        },
        "userName": {
          "type": "string"
        },
        "userEmail": {
          "type": "string"
        },
        "accountId": {
          "$ref": "#/$defs/accountId"
        },
        "auditType": {
          "type": "string"
        },
        "targetType": {
          "type": "string"
        },
        "targetId": {
          "type": "string"
        },
        "targetName": {
          "type": "string"
        },
        "ipAddress": {
          "type": "string"
        },
        "userAgent": {
          "type": "object",
          "properties": {
            "browserFamily": {
              "type": "string"
            },
            "browserVersion": {
              "type": "string"
            },
            "osFamily": {
              "type": "string"
            },
            "osVersion": {
              "type": "string"
            }
          }
        },
        "locationId": {
          "$ref": "#/$defs/LocationId"
        },
        "locationName": {
          "type": "string"
        },
        "dataSchemas": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "data": {
          "type": "array",
          "description": "Structured audit details organized into sections for data-driven UI rendering. Each section represents a logical grouping of related settings or information, typically corresponding to a page or sub-section in the web application UI. The frontend can display new audit types and details without code changes by rendering these sections as labeled groups with rows of label-value pairs.\n",
          "items": {
            "$ref": "#/$defs/GenericDetails"
          }
        }
      }
    },
    "GenericDetails": {
      "type": "object",
      "required": [
        "type",
        "id",
        "header",
        "rows"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "details"
          ],
          "description": "Section type identifier. Currently only 'details' is supported. Additional section types may be added in the future.\n"
        },
        "id": {
          "type": "string",
          "description": "Machine-readable identifier for this section in camelCase. Should match the corresponding API v3 field name when applicable.\n"
        },
        "header": {
          "type": "string",
          "description": "Human-readable section label shown to users, representing a breadcrumb path to the corresponding screen in the web application. Use \" - \" as a separator for nested screens.\n"
        },
        "rows": {
          "type": "array",
          "description": "List of setting changes or information displayed as rows in a table, each showing a label, current value, and optionally the previous value.\n",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/LabelValuePair"
              },
              {
                "type": "object",
                "properties": {
                  "format": {
                    "type": "string",
                    "enum": [
                      "date-time",
                      "boolean"
                    ],
                    "description": "Optional format hint for the frontend to properly parse and display the value.\n\n* `date-time`: Value is an ISO 8601 timestamp and should be rendered as a formatted date/time.\n* `boolean`: Value is a boolean toggle (expects \"Yes\", \"True\", \"No\", or \"False\").\n"
                  },
                  "oldValue": {
                    "type": "string",
                    "description": "Previous value of the setting before the change. Only include when there was a previous value (e.g., on updates). Omit for creates or when not applicable. Use empty string \"\" to represent \"no value\" rather than null.\n"
                  }
                }
              }
            ]
          }
        }
      }
    },
    "LabelValuePair": {
      "type": "object",
      "description": "Represents a setting or piece of information displayed in the audit log UI. Each pair contains a human-readable label matching the UI, a machine-readable identifier matching the API field name, and the current value.\n",
      "required": [
        "id",
        "label",
        "value"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Machine-readable identifier in camelCase. Should match the corresponding API v3 field name when applicable to make it easy to relate the API and audit log.\n"
        },
        "label": {
          "type": "string",
          "description": "Human-readable label displayed to users in the frontend application UI, matching the label shown in the corresponding settings screen. Should be written in English.\n"
        },
        "value": {
          "type": "string",
          "description": "Current value of the setting as a string. Use empty string \"\" to represent \"no value\" rather than null.\n"
        }
      }
    },
    "LocationId": {
      "description": "ID Of the location.",
      "minLength": 1,
      "type": [
        "string",
        "null"
      ]
    },
    "PaginatedResponseNoTotalSize": {
      "type": "object",
      "description": "Used to wrap results for a paginated response, containing information on how to retrieve further pages.\n",
      "properties": {
        "nextPageToken": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Token to retrieve the next page. The value of this token is passed into the field pageToken. This value can be null if there is no next page.\n"
        },
        "prevPageToken": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Token to retrieve the previous page. The value of this token is passed into the field pageToken. This value can be null of there is no previous page.\n"
        },
        "results": {
          "type": "array",
          "readOnly": true,
          "description": "The result set from a collection API call.",
          "items": {
            "type": "object"
          }
        }
      },
      "required": [
        "nextPageToken",
        "prevPageToken",
        "results"
      ]
    },
    "accountId": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "userId": {
      "type": "string"
    }
  }
}