{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/SetupAgentsWorkflowLessonsResult",
  "definitions": {
    "SetupAgentsWorkflowLessonsResult": {
      "type": "object",
      "properties": {
        "lessons": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/OperationalLessonRecord"
          }
        },
        "health": {
          "$ref": "#/definitions/LessonHealth"
        },
        "migration": {
          "$ref": "#/definitions/LessonMigrationReport"
        },
        "cwd": {
          "type": "string"
        }
      },
      "required": ["lessons", "health", "cwd"],
      "additionalProperties": false
    },
    "OperationalLessonRecord": {
      "$ref": "#/definitions/LessonRecord"
    },
    "LessonRecord": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "category": {
          "$ref": "#/definitions/LessonCategory"
        },
        "topic": {
          "type": "string"
        },
        "problem": {
          "type": "string"
        },
        "cause": {
          "type": "string"
        },
        "solution": {
          "type": "string"
        },
        "source": {
          "type": "object",
          "properties": {
            "taskIds": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "evidenceIds": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "legacy": {
              "type": "object",
              "properties": {
                "file": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                }
              },
              "required": ["file", "id"],
              "additionalProperties": false
            }
          },
          "required": ["taskIds", "evidenceIds"],
          "additionalProperties": false
        },
        "confidence": {
          "type": "number"
        },
        "timestamp": {
          "type": "string"
        }
      },
      "required": ["id", "category", "topic", "problem", "cause", "solution", "source", "confidence", "timestamp"],
      "additionalProperties": false
    },
    "LessonCategory": {
      "type": "string",
      "enum": ["operational", "delivery", "estimation"]
    },
    "LessonHealth": {
      "type": "object",
      "properties": {
        "healthy": {
          "type": "boolean"
        },
        "canonicalFile": {
          "type": "string"
        },
        "sourceRecords": {
          "type": "object",
          "properties": {
            "canonical": {
              "type": "number"
            },
            "operationalLegacy": {
              "type": "number"
            },
            "estimationLegacy": {
              "type": "number"
            },
            "evidence": {
              "type": "number"
            }
          },
          "required": ["canonical", "operationalLegacy", "estimationLegacy", "evidence"],
          "additionalProperties": false
        },
        "projectedRecords": {
          "type": "number"
        },
        "duplicates": {
          "type": "number"
        },
        "invalidRecords": {
          "type": "number"
        },
        "migrationCandidates": {
          "type": "number"
        }
      },
      "required": [
        "healthy",
        "canonicalFile",
        "sourceRecords",
        "projectedRecords",
        "duplicates",
        "invalidRecords",
        "migrationCandidates"
      ],
      "additionalProperties": false
    },
    "LessonMigrationReport": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "migrated": {
          "type": "number"
        },
        "healthy": {
          "type": "boolean"
        },
        "canonicalFile": {
          "type": "string"
        },
        "sourceRecords": {
          "type": "object",
          "properties": {
            "canonical": {
              "type": "number"
            },
            "operationalLegacy": {
              "type": "number"
            },
            "estimationLegacy": {
              "type": "number"
            },
            "evidence": {
              "type": "number"
            }
          },
          "required": ["canonical", "operationalLegacy", "estimationLegacy", "evidence"],
          "additionalProperties": false
        },
        "projectedRecords": {
          "type": "number"
        },
        "duplicates": {
          "type": "number"
        },
        "invalidRecords": {
          "type": "number"
        },
        "migrationCandidates": {
          "type": "number"
        }
      },
      "required": [
        "canonicalFile",
        "duplicates",
        "healthy",
        "invalidRecords",
        "migrated",
        "migrationCandidates",
        "projectedRecords",
        "sourceRecords"
      ]
    }
  }
}
