{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usetrackly-app/json-schema/usetrackly-app-company-list-schema.json",
  "title": "CompanyList",
  "description": "Response envelope for `/api/v1/companies`.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usetrackly-app-openapi.json#/components/schemas/CompanyList",
  "type": "object",
  "not": {
    "required": [
      "countsState"
    ]
  },
  "required": [
    "success",
    "companies",
    "count"
  ],
  "properties": {
    "success": {
      "type": "boolean",
      "const": true
    },
    "companies": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CompanyDetailed"
      }
    },
    "count": {
      "type": "integer",
      "description": "Number of companies returned in this page (respects `limit`/`offset`)."
    },
    "total": {
      "type": "integer",
      "description": "Total number of companies matching the filter across all pages."
    },
    "servedFromCache": {
      "type": "boolean"
    },
    "dataFreshnessMs": {
      "type": "integer"
    }
  },
  "$defs": {
    "CompanyDetailed": {
      "type": "object",
      "description": "Full company record returned by `/api/v1/companies` and `/api/v1/companies/search`.",
      "required": [
        "id",
        "name",
        "domain",
        "isFavorite",
        "pmJobCount",
        "totalJobCount",
        "mbaJobCount",
        "functionCounts"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "domain": {
          "type": "string"
        },
        "logoUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "atsType": {
          "type": [
            "string",
            "null"
          ],
          "description": "ATS vendor slug (e.g. greenhouse, lever, ashby, eightfold)."
        },
        "industry": {
          "type": [
            "string",
            "null"
          ]
        },
        "isFavorite": {
          "type": "boolean"
        },
        "pmJobCount": {
          "type": "integer",
          "description": "Number of PM-classified roles currently active at this company."
        },
        "totalJobCount": {
          "type": "integer",
          "description": "Total active roles at this company (post-filter)."
        },
        "mbaJobCount": {
          "type": "integer",
          "description": "Active MBA-level roles at this company."
        },
        "functionCounts": {
          "type": "object",
          "description": "Map of `JobFunction` value to active role count at this company.",
          "additionalProperties": {
            "type": "integer"
          }
        },
        "companyStage": {
          "type": [
            "string",
            "null"
          ]
        },
        "fundingStage": {
          "type": [
            "string",
            "null"
          ]
        },
        "fundingSeries": {
          "type": [
            "string",
            "null"
          ]
        },
        "valuationMillions": {
          "type": [
            "number",
            "null"
          ]
        },
        "lastFinancingDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "ycBatch": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}