{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grepr/json-schema/grepr-agent-suggestion-apply-result-schema.json",
  "title": "AgentSuggestionApplyResult",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grepr-agent-suggestions-api-openapi.yml#/components/schemas/AgentSuggestionApplyResult",
  "properties": {
    "appliedJobVersion": {
      "description": "The new job version the suggestion was applied as, or absent when it was rejected by verification. Applying restarts the pipeline from a savepoint, so the new version reaches its desired state asynchronously.",
      "format": "int64",
      "type": "integer"
    },
    "findings": {
      "default": [],
      "description": "Verification findings that blocked the apply. When present the pipeline is untouched and the suggestion stays PENDING: the pipeline changed since the suggestion was recorded, so the change is no longer safe to apply as-is.",
      "items": {
        "$ref": "#/$defs/ChangeFinding"
      },
      "type": "array"
    },
    "suggestion": {
      "$ref": "#/$defs/AgentSuggestion"
    }
  },
  "required": [
    "suggestion"
  ],
  "type": "object",
  "$defs": {
    "AgentSuggestion": {
      "properties": {
        "agentId": {
          "type": "string"
        },
        "appliedJobVersion": {
          "format": "int64",
          "type": "integer"
        },
        "baseJobVersion": {
          "format": "int64",
          "type": "integer"
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "investigationId": {
          "type": "string"
        },
        "jobId": {
          "type": "string"
        },
        "organizationId": {
          "type": "string"
        },
        "reviewedAt": {
          "format": "date-time",
          "type": "string"
        },
        "reviewedBy": {
          "type": "string"
        },
        "samples": {
          "items": {
            "$ref": "#/$defs/LogEvent"
          },
          "type": "array"
        },
        "status": {
          "enum": [
            "PENDING",
            "APPLIED",
            "REJECTED"
          ],
          "type": "string"
        },
        "teamIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "templateInputsPatch": {
          "$ref": "#/$defs/JsonNode"
        },
        "toolCallId": {
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        }
      },
      "type": "object"
    },
    "Any": {
      "description": "A value that can be a primitive (String or number), a list, or a map."
    },
    "ChangeFinding": {
      "description": "Verification findings that blocked the change. When present the pipeline is untouched: fix the findings and submit again.",
      "properties": {
        "code": {
          "enum": [
            "INVALID_GROK_RULE",
            "SAMPLE_PREDICATE_MISMATCH",
            "RULE_NOT_MATCHED",
            "RULE_SHADOWED",
            "RULE_EXTRACTED_NOTHING",
            "RULE_NOT_FOUND",
            "AMBIGUOUS_PREDICATE",
            "NO_SAMPLES",
            "OPERATION_DELETED",
            "RULE_DELETED",
            "HELPER_RULE_DELETED",
            "RESOLUTION_FAILED",
            "DISALLOWED_INPUT_CHANGE",
            "UNVERIFIABLE_CHANGE",
            "NO_EFFECTIVE_CHANGE"
          ],
          "type": "string"
        },
        "details": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        "message": {
          "type": "string"
        },
        "sampleId": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "JsonNode": {
      "description": "A partial templateInputs object to deep-merge into the pipeline's current inputs. Objects merge recursively, and an array of named objects (like input.parsers) merges by entry name, so entries you omit are kept. Scalars and arrays of non-objects replace whole.",
      "type": "object"
    },
    "LogEvent": {
      "description": "A log event.",
      "properties": {
        "attributes": {
          "additionalProperties": {
            "$ref": "#/$defs/Any"
          },
          "description": "Attributes associated with the event, a map from attribute name to attribute value, which may be a nested map or list.",
          "type": "object"
        },
        "eventTimestamp": {
          "description": "Event timestamp that is in the record. Milliseconds from epoch.",
          "format": "int64",
          "type": "integer"
        },
        "id": {
          "description": "Id of the event.",
          "type": "string"
        },
        "message": {
          "description": "The log message.",
          "type": "string"
        },
        "receivedTimestamp": {
          "description": "Timestamp when the event was received by Grepr. Milliseconds from epoch.",
          "format": "int64",
          "type": "integer"
        },
        "severity": {
          "description": "The log severity. Higher numbers mean higher severity, following the OTel format 1-24.",
          "format": "int32",
          "type": "integer"
        },
        "tags": {
          "additionalProperties": {
            "description": "Tags associated with the event, a map from tag name to set of tag values.",
            "items": {
              "description": "Tags associated with the event, a map from tag name to set of tag values.",
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "description": "Tags associated with the event, a map from tag name to set of tag values.",
          "type": "object"
        }
      },
      "required": [
        "eventTimestamp",
        "id",
        "receivedTimestamp"
      ],
      "type": "object"
    }
  }
}