{
  "type": "object",
  "properties": {
    "profile_version": {
      "type": "string",
      "const": "v1"
    },
    "project": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "repo_url": {
          "type": "string"
        },
        "primary_languages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "package_managers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "deployment_targets": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "name",
        "repo_url",
        "primary_languages",
        "package_managers",
        "deployment_targets"
      ],
      "additionalProperties": false
    },
    "services": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "frontend",
              "backend",
              "worker"
            ]
          },
          "runtime": {
            "type": "string"
          },
          "framework": {
            "type": "string"
          },
          "paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "owns_routes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "kind",
          "runtime",
          "framework",
          "paths",
          "owns_routes",
          "depends_on"
        ],
        "additionalProperties": false
      }
    },
    "infrastructure": {
      "type": "object",
      "properties": {
        "databases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "queues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "object_storage": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "external_services": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "databases",
        "queues",
        "object_storage",
        "external_services"
      ],
      "additionalProperties": false
    },
    "critical_paths": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "owner_service": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "owner_service",
          "notes"
        ],
        "additionalProperties": false
      }
    },
    "repo": {
      "type": "object",
      "properties": {
        "root_paths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "generated_paths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "do_not_edit_paths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "root_paths",
        "generated_paths",
        "do_not_edit_paths"
      ],
      "additionalProperties": false
    },
    "developer_workflows": {
      "type": "object",
      "properties": {
        "install": {
          "type": "string"
        },
        "build": {
          "type": "string"
        },
        "test": {
          "type": "string"
        },
        "lint": {
          "type": "string"
        }
      },
      "required": [
        "install",
        "build",
        "test",
        "lint"
      ],
      "additionalProperties": false
    },
    "debugbundle": {
      "type": "object",
      "properties": {
        "profile_owner": {
          "type": "string"
        },
        "last_reviewed_at": {
          "type": "string",
          "format": "date-time"
        },
        "validation_status": {
          "type": "string",
          "enum": [
            "static-analysis-only",
            "agent-validated"
          ]
        },
        "skill_path": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      },
      "required": [
        "profile_owner",
        "last_reviewed_at",
        "validation_status",
        "skill_path",
        "notes"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "profile_version",
    "project",
    "services",
    "infrastructure",
    "critical_paths",
    "repo",
    "developer_workflows",
    "debugbundle"
  ],
  "additionalProperties": false,
  "$schema": "https://json-schema.org/draft/2020-12/schema#",
  "$id": "https://debugbundle.com/schemas/profile.json",
  "title": "DebugBundle Repository Profile Schema"
}
