{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/popp/json-schema/popp-analysis-schema.json",
  "title": "Analysis",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/popp-analysis-api-openapi.yml#/components/schemas/Analysis",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The unique identifier for the analysis."
    },
    "title": {
      "type": "string",
      "description": "The title of the analysis."
    },
    "jobDescription": {
      "type": "string",
      "description": "The job description text."
    },
    "status": {
      "type": "string",
      "enum": [
        "DRAFT",
        "PROCESSING",
        "LIVE",
        "ARCHIVED"
      ],
      "description": "The current status of the analysis."
    },
    "requirements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier for the requirement."
          },
          "text": {
            "type": "string",
            "description": "The original requirement text."
          },
          "generatedText": {
            "type": [
              "string",
              "null"
            ],
            "description": "AI-generated version of the requirement text."
          },
          "isMandatory": {
            "type": "boolean",
            "description": "Whether this is a knockout requirement."
          },
          "weight": {
            "type": "number",
            "description": "Scoring weight for this requirement."
          }
        }
      },
      "description": "The analysis requirements. Only included in single analysis responses."
    },
    "candidatesCount": {
      "type": "integer",
      "description": "Total number of candidates in the analysis."
    },
    "candidatesRequirementsMetCount": {
      "type": "integer",
      "description": "Number of candidates who met requirements."
    },
    "candidatesRequirementsNotMetCount": {
      "type": "integer",
      "description": "Number of candidates who did not meet requirements."
    },
    "externalId": {
      "type": [
        "string",
        "null"
      ],
      "description": "External system identifier."
    },
    "isWorkflowManaged": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "True when the analysis was created for an analysis node in a published workflow. A workflow-managed analysis can't be edited, archived or sent candidates through the analysis endpoints. To use different requirements, publish a new version of the workflow. Its results are read under the workflow (`GET /v1/workflows/{workflowId}/analyses/{workflowNodeSlug}`). Null for an analysis created outside workflows."
    },
    "workflowId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The workflow the analysis belongs to."
    },
    "workflowVersionId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The workflow version that created the analysis."
    },
    "workflowRunId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Not used for analyses. Always null."
    },
    "workflowNodeId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The analysis node's id in that workflow version."
    },
    "workflowNodeSlug": {
      "type": [
        "string",
        "null"
      ],
      "description": "The analysis node's slug. Returned by `GET /v1/analyses/{id}`; null elsewhere."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of creation."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of last update."
    }
  }
}