{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-wins-response-schema.json",
  "title": "WinsResponse",
  "description": "What got better since ``since``. Positive only.\n\nWith ``author`` every section narrows to that person's commits and the\nfiles they touched. ``unavailable`` names wins the index cannot answer\nfrom stored data (no history is kept for them).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/repowise-dev-history-api-openapi.yml#/components/schemas/WinsResponse",
  "properties": {
    "since": {
      "type": "string",
      "format": "date-time",
      "title": "Since"
    },
    "until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Until"
    },
    "author": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Author"
    },
    "findings_resolved": {
      "$ref": "#/$defs/WinsFindingsResolved"
    },
    "files_improved": {
      "$ref": "#/$defs/WinsFilesImproved"
    },
    "refactorings_landed": {
      "$ref": "#/$defs/WinsRefactorings"
    },
    "unavailable": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Unavailable",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "since",
    "findings_resolved",
    "files_improved",
    "refactorings_landed"
  ],
  "$defs": {
    "WinsFileGain": {
      "properties": {
        "path": {
          "type": "string",
          "title": "Path"
        },
        "before": {
          "type": "number",
          "title": "Before"
        },
        "after": {
          "type": "number",
          "title": "After"
        },
        "gain": {
          "type": "number",
          "title": "Gain"
        }
      },
      "type": "object",
      "required": [
        "path",
        "before",
        "after",
        "gain"
      ],
      "title": "WinsFileGain"
    },
    "WinsFilesImproved": {
      "properties": {
        "count": {
          "type": "integer",
          "title": "Count"
        },
        "baseline_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Baseline At"
        },
        "current_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Current At"
        },
        "top": {
          "items": {
            "$ref": "#/$defs/WinsFileGain"
          },
          "type": "array",
          "title": "Top",
          "default": []
        }
      },
      "type": "object",
      "required": [
        "count"
      ],
      "title": "WinsFilesImproved",
      "description": "Files commits in the window touched whose score rose between the snapshot\nat ``baseline_at`` and the one at ``current_at``."
    },
    "WinsFindingsResolved": {
      "properties": {
        "count": {
          "type": "integer",
          "title": "Count"
        },
        "commits": {
          "type": "integer",
          "title": "Commits"
        },
        "top_commits": {
          "items": {
            "$ref": "#/$defs/WinsResolvingCommit"
          },
          "type": "array",
          "title": "Top Commits",
          "default": []
        }
      },
      "type": "object",
      "required": [
        "count",
        "commits"
      ],
      "title": "WinsFindingsResolved",
      "description": "Findings commits in the window resolved. Resolved findings are stored as\nper-commit counts, so the top items are the commits that resolved most."
    },
    "WinsRefactoring": {
      "properties": {
        "file_path": {
          "type": "string",
          "title": "File Path"
        },
        "target_symbol": {
          "type": "string",
          "title": "Target Symbol"
        },
        "refactoring_type": {
          "type": "string",
          "title": "Refactoring Type"
        },
        "resolved_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resolved At"
        },
        "before_ccn": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Before Ccn"
        },
        "after_ccn": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "After Ccn"
        },
        "before_nloc": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Before Nloc"
        },
        "after_nloc": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "After Nloc"
        }
      },
      "type": "object",
      "required": [
        "file_path",
        "target_symbol",
        "refactoring_type"
      ],
      "title": "WinsRefactoring",
      "description": "A refactoring plan that landed: its target is gone or shrank as planned."
    },
    "WinsRefactorings": {
      "properties": {
        "count": {
          "type": "integer",
          "title": "Count"
        },
        "top": {
          "items": {
            "$ref": "#/$defs/WinsRefactoring"
          },
          "type": "array",
          "title": "Top",
          "default": []
        }
      },
      "type": "object",
      "required": [
        "count"
      ],
      "title": "WinsRefactorings"
    },
    "WinsResolvingCommit": {
      "properties": {
        "sha": {
          "type": "string",
          "title": "Sha"
        },
        "subject": {
          "type": "string",
          "title": "Subject"
        },
        "author_name": {
          "type": "string",
          "title": "Author Name"
        },
        "committed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Committed At"
        },
        "resolved": {
          "type": "integer",
          "title": "Resolved"
        }
      },
      "type": "object",
      "required": [
        "sha",
        "subject",
        "author_name",
        "resolved"
      ],
      "title": "WinsResolvingCommit"
    }
  }
}