{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "request_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "tool": {
      "type": "string",
      "enum": ["people_search", "company_search"]
    },
    "entity_type": {
      "type": "string",
      "enum": ["person", "company"]
    },
    "status": {
      "type": "string",
      "enum": ["running", "completed", "partial", "not_found", "failed"]
    },
    "done": {
      "type": "boolean"
    },
    "result_count": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "enriched_count": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "result_position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99
          },
          "result_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "status": {
            "type": "string",
            "enum": ["queued", "running", "completed", "not_found", "failed"]
          },
          "result": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": ["string", "null"]
                  },
                  "domain": {
                    "type": ["string", "null"]
                  },
                  "websiteUrl": {
                    "type": ["string", "null"]
                  },
                  "linkedinUrl": {
                    "type": ["string", "null"]
                  },
                  "industry": {
                    "type": ["string", "null"]
                  },
                  "companyType": {
                    "type": ["string", "null"]
                  },
                  "headquarters": {
                    "type": ["string", "null"]
                  },
                  "headquartersCountry": {
                    "type": ["string", "null"]
                  },
                  "foundedYear": {
                    "type": ["string", "null"]
                  },
                  "employees": {
                    "type": ["string", "null"]
                  },
                  "funding": {
                    "type": ["string", "null"]
                  },
                  "fundingStage": {
                    "type": ["string", "null"]
                  },
                  "revenue": {
                    "type": ["string", "null"]
                  },
                  "description": {
                    "type": ["string", "null"]
                  },
                  "sourceUrl": {
                    "type": ["string", "null"]
                  },
                  "sourceTitle": {
                    "type": ["string", "null"]
                  },
                  "publishedDate": {
                    "type": ["string", "null"]
                  },
                  "matchReason": {
                    "type": ["string", "null"]
                  },
                  "employeeCount": {
                    "type": ["number", "null"]
                  },
                  "technographics": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "categories": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "totalFunding": {
                    "type": ["string", "null"]
                  },
                  "latestFundingDate": {
                    "type": ["string", "null"]
                  },
                  "revenueRange": {
                    "type": ["string", "null"]
                  },
                  "headcountGrowthYoYPct": {
                    "type": ["number", "null"]
                  },
                  "openJobsCount": {
                    "type": ["number", "null"]
                  },
                  "jobTitle": {
                    "type": ["string", "null"]
                  },
                  "company": {
                    "type": ["string", "null"]
                  },
                  "companyDomain": {
                    "type": ["string", "null"]
                  },
                  "location": {
                    "type": ["string", "null"]
                  },
                  "bio": {
                    "type": ["string", "null"]
                  },
                  "school": {
                    "type": ["string", "null"]
                  },
                  "major": {
                    "type": ["string", "null"]
                  },
                  "graduationYear": {
                    "type": ["number", "null"]
                  },
                  "workHistory": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": ["string", "null"]
                            },
                            "company": {
                              "type": ["string", "null"]
                            },
                            "companyDomain": {
                              "type": ["string", "null"]
                            },
                            "institution": {
                              "type": ["string", "null"]
                            },
                            "institutionDomain": {
                              "type": ["string", "null"]
                            },
                            "location": {
                              "type": ["string", "null"]
                            },
                            "dateFrom": {
                              "type": ["string", "null"]
                            },
                            "dateTo": {
                              "type": ["string", "null"]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "educationHistory": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": ["string", "null"]
                            },
                            "company": {
                              "type": ["string", "null"]
                            },
                            "companyDomain": {
                              "type": ["string", "null"]
                            },
                            "institution": {
                              "type": ["string", "null"]
                            },
                            "institutionDomain": {
                              "type": ["string", "null"]
                            },
                            "location": {
                              "type": ["string", "null"]
                            },
                            "dateFrom": {
                              "type": ["string", "null"]
                            },
                            "dateTo": {
                              "type": ["string", "null"]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "clubs": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sports": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interests": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "email": {
                    "type": ["string", "null"]
                  },
                  "phone": {
                    "type": ["string", "null"]
                  },
                  "university": {
                    "type": ["string", "null"]
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["result_position", "result_number", "status", "result"],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "request_id",
    "tool",
    "entity_type",
    "status",
    "done",
    "result_count",
    "enriched_count",
    "results"
  ],
  "additionalProperties": false
}
