{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/companydata-dk/json-schema/companydata-dk-participant-search-response-schema.json",
  "title": "ParticipantSearchResponse",
  "description": "Response for participant search endpoint.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/companydata-dk-participants-api-openapi.yml#/components/schemas/ParticipantSearchResponse",
  "properties": {
    "data": {
      "items": {
        "$ref": "#/$defs/app__models__participant__ParticipantSearchResult"
      },
      "type": "array",
      "title": "Data",
      "description": "Matching participants"
    },
    "meta": {
      "additionalProperties": true,
      "type": "object",
      "title": "Meta",
      "description": "Response metadata"
    },
    "pagination": {
      "additionalProperties": true,
      "type": "object",
      "title": "Pagination",
      "description": "Pagination info"
    }
  },
  "type": "object",
  "required": [
    "data"
  ],
  "$defs": {
    "ParticipantSearchResultRelation": {
      "properties": {
        "cvr": {
          "type": "string",
          "title": "Cvr",
          "description": "Company CVR number"
        },
        "company_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Company Name",
          "description": "Company name"
        },
        "role_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Role Name",
          "description": "Role in the company"
        }
      },
      "type": "object",
      "required": [
        "cvr"
      ],
      "title": "ParticipantSearchResultRelation",
      "description": "A company relation shown in search results."
    },
    "app__models__participant__ParticipantSearchResult": {
      "properties": {
        "unit_number": {
          "type": "integer",
          "title": "Unit Number",
          "description": "CVR unit number for lookups"
        },
        "unit_type": {
          "type": "string",
          "title": "Unit Type",
          "description": "Type — always PERSON (participants are individuals)"
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Participant name"
        },
        "cvr": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cvr",
          "description": "Unused — participants are individuals (kept for response-shape stability)"
        },
        "company_relations": {
          "items": {
            "$ref": "#/$defs/ParticipantSearchResultRelation"
          },
          "type": "array",
          "title": "Company Relations",
          "description": "Active roles (max 5). A company may appear more than once if the participant holds several roles there (e.g. owner + director)."
        },
        "company_count": {
          "type": "integer",
          "title": "Company Count",
          "description": "Number of distinct companies the participant is or has been related to (matches what the portfolio expands to).",
          "default": 0
        },
        "active_company_count": {
          "type": "integer",
          "title": "Active Company Count",
          "description": "Distinct companies where the participant currently holds an active role.",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "unit_number",
        "unit_type",
        "name"
      ],
      "title": "ParticipantSearchResult",
      "description": "Simplified participant for search results."
    }
  }
}