{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Resource identifier returned by the operation."
          },
          "workspace_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Workspace that owns this record."
          },
          "project_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Project that owns this record."
          },
          "kind": {
            "type": "string",
            "enum": [
              "domain",
              "url"
            ]
          },
          "value": {
            "type": "string"
          },
          "identity": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "import",
              "agent_proposal"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "proposed",
              "active",
              "rejected"
            ],
            "description": "Resource lifecycle status."
          },
          "comments": {
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 120,
              "format": "starts_with",
              "pattern": "^#.*"
            }
          },
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "description": "Optimistic concurrency revision; supply it as expectedRevision on the next write."
          },
          "created_by": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "approved_by": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "description": "UTC timestamp when the record was created."
          },
          "updated_at": {
            "type": "string",
            "description": "UTC timestamp of the last record update."
          }
        },
        "required": [
          "id",
          "workspace_id",
          "project_id",
          "kind",
          "value",
          "identity",
          "source",
          "status",
          "comments",
          "revision",
          "created_by",
          "approved_by",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      }
    },
    "created": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "True when this request created the record; false when an existing record was reused."
    },
    "unchanged": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "revision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Optimistic concurrency revision; supply it as expectedRevision on the next write."
    }
  },
  "required": [
    "rules",
    "created",
    "unchanged",
    "revision"
  ],
  "additionalProperties": {}
}
