{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-fix-item-schema.json",
  "title": "FixItem",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/repowise-dev-code-health-api-openapi.yml#/components/schemas/FixItem",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "rank": {
      "type": "integer",
      "title": "Rank"
    },
    "tier": {
      "type": "string",
      "enum": [
        "now",
        "next",
        "later"
      ],
      "title": "Tier"
    },
    "kind": {
      "type": "string",
      "enum": [
        "refactor",
        "perf_fix",
        "finding"
      ],
      "title": "Kind"
    },
    "improves": {
      "type": "string",
      "enum": [
        "defect",
        "maintainability",
        "performance"
      ],
      "title": "Improves"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "target": {
      "$ref": "#/$defs/FixTarget"
    },
    "why": {
      "type": "string",
      "title": "Why"
    },
    "facts": {
      "items": {
        "$ref": "#/$defs/FixFact"
      },
      "type": "array",
      "title": "Facts"
    },
    "action": {
      "$ref": "#/$defs/FixAction"
    },
    "gain": {
      "$ref": "#/$defs/FixGain"
    },
    "effort": {
      "$ref": "#/$defs/FixEffortEstimate"
    },
    "risk": {
      "$ref": "#/$defs/FixRisk"
    },
    "confidence": {
      "$ref": "#/$defs/FixConfidence"
    },
    "verify": {
      "$ref": "#/$defs/FixVerify"
    },
    "context": {
      "items": {
        "$ref": "#/$defs/FixContext"
      },
      "type": "array",
      "title": "Context"
    },
    "source": {
      "$ref": "#/$defs/FixSource"
    },
    "next_call": {
      "$ref": "#/$defs/ActionCommand"
    },
    "why_ranked": {
      "items": {
        "$ref": "#/$defs/FixRankFact"
      },
      "type": "array",
      "title": "Why Ranked",
      "default": []
    },
    "value": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Value"
    }
  },
  "type": "object",
  "required": [
    "id",
    "rank",
    "tier",
    "kind",
    "improves",
    "title",
    "target",
    "why",
    "facts",
    "action",
    "gain",
    "effort",
    "risk",
    "confidence",
    "verify",
    "context",
    "source",
    "next_call"
  ],
  "$defs": {
    "ActionCommand": {
      "properties": {
        "purpose": {
          "type": "string",
          "title": "Purpose"
        },
        "mcp": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Mcp"
        },
        "cli": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cli"
        },
        "tool": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tool"
        },
        "arguments": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Arguments"
        }
      },
      "type": "object",
      "required": [
        "purpose"
      ],
      "title": "ActionCommand"
    },
    "FixAction": {
      "properties": {
        "summary": {
          "type": "string",
          "title": "Summary"
        },
        "steps": {
          "items": {
            "$ref": "#/$defs/FixStep"
          },
          "type": "array",
          "title": "Steps"
        },
        "steps_total": {
          "type": "integer",
          "title": "Steps Total"
        },
        "mechanical": {
          "type": "boolean",
          "title": "Mechanical"
        }
      },
      "type": "object",
      "required": [
        "summary",
        "steps",
        "steps_total",
        "mechanical"
      ],
      "title": "FixAction"
    },
    "FixConfidence": {
      "properties": {
        "level": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ],
          "title": "Level"
        },
        "reason": {
          "type": "string",
          "title": "Reason"
        }
      },
      "type": "object",
      "required": [
        "level",
        "reason"
      ],
      "title": "FixConfidence"
    },
    "FixContext": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "value": {
          "type": "string",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "label",
        "value"
      ],
      "title": "FixContext"
    },
    "FixEffortEstimate": {
      "properties": {
        "bucket": {
          "type": "string",
          "enum": [
            "S",
            "M",
            "L",
            "XL"
          ],
          "title": "Bucket"
        },
        "basis": {
          "type": "string",
          "title": "Basis"
        }
      },
      "type": "object",
      "required": [
        "bucket",
        "basis"
      ],
      "title": "FixEffortEstimate"
    },
    "FixFact": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "value": {
          "type": "string",
          "title": "Value"
        },
        "basis": {
          "type": "string",
          "enum": [
            "measured",
            "inferred",
            "unknown"
          ],
          "title": "Basis",
          "default": "measured"
        }
      },
      "type": "object",
      "required": [
        "label",
        "value"
      ],
      "title": "FixFact"
    },
    "FixGain": {
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "health_points",
            "performance"
          ],
          "title": "Kind"
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Value"
        },
        "text": {
          "type": "string",
          "title": "Text"
        }
      },
      "type": "object",
      "required": [
        "kind",
        "value",
        "text"
      ],
      "title": "FixGain"
    },
    "FixRankFact": {
      "properties": {
        "factor": {
          "type": "string",
          "title": "Factor"
        },
        "value": {
          "type": "string",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "factor",
        "value"
      ],
      "title": "FixRankFact"
    },
    "FixRisk": {
      "properties": {
        "level": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ],
          "title": "Level"
        },
        "dependents": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Dependents"
        },
        "files_touched": {
          "type": "integer",
          "title": "Files Touched"
        },
        "text": {
          "type": "string",
          "title": "Text"
        }
      },
      "type": "object",
      "required": [
        "level",
        "dependents",
        "files_touched",
        "text"
      ],
      "title": "FixRisk"
    },
    "FixSource": {
      "properties": {
        "opportunity_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Opportunity Id"
        },
        "plan_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Plan Ids",
          "default": []
        },
        "finding_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Finding Ids",
          "default": []
        }
      },
      "type": "object",
      "title": "FixSource"
    },
    "FixStep": {
      "properties": {
        "order": {
          "type": "integer",
          "title": "Order"
        },
        "text": {
          "type": "string",
          "title": "Text"
        },
        "file_path": {
          "type": "string",
          "title": "File Path"
        },
        "line": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line"
        },
        "mechanical": {
          "type": "boolean",
          "title": "Mechanical",
          "default": false
        },
        "signature": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Signature"
        },
        "call": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Call"
        },
        "command": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Command"
        },
        "notes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Notes",
          "default": []
        }
      },
      "type": "object",
      "required": [
        "order",
        "text",
        "file_path"
      ],
      "title": "FixStep"
    },
    "FixTarget": {
      "properties": {
        "file_path": {
          "type": "string",
          "title": "File Path"
        },
        "symbol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Symbol"
        },
        "line_start": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line Start"
        },
        "line_end": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line End"
        }
      },
      "type": "object",
      "required": [
        "file_path"
      ],
      "title": "FixTarget"
    },
    "FixTest": {
      "properties": {
        "path": {
          "type": "string",
          "title": "Path"
        },
        "reason": {
          "type": "string",
          "title": "Reason"
        }
      },
      "type": "object",
      "required": [
        "path",
        "reason"
      ],
      "title": "FixTest"
    },
    "FixVerify": {
      "properties": {
        "tests": {
          "items": {
            "$ref": "#/$defs/FixTest"
          },
          "type": "array",
          "title": "Tests"
        },
        "tests_total": {
          "type": "integer",
          "title": "Tests Total"
        },
        "command": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Command"
        },
        "basis": {
          "type": "string",
          "enum": [
            "measured",
            "inferred",
            "unknown"
          ],
          "title": "Basis"
        },
        "prerequisite": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Prerequisite"
        }
      },
      "type": "object",
      "required": [
        "tests",
        "tests_total",
        "command",
        "basis"
      ],
      "title": "FixVerify"
    }
  }
}