{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/abm-dev/json-schema/abm-dev-person-finder-job-schema.json",
  "title": "PersonFinderJob",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/abm-dev-openapi.json#/components/schemas/PersonFinderJob",
  "type": "object",
  "properties": {
    "jobId": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "processing",
        "completed",
        "failed",
        "cancelled"
      ]
    },
    "companyName": {
      "type": "string"
    },
    "roles": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "percentComplete": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "currentStep": {
      "type": "string",
      "description": "Human-readable description of the current processing step"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "completedAt": {
      "type": "string",
      "format": "date-time"
    },
    "result": {
      "type": "object",
      "properties": {
        "candidates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PersonFinderCandidate"
          }
        },
        "rolesSearched": {
          "type": "integer"
        },
        "durationSeconds": {
          "type": "number"
        }
      }
    },
    "error": {
      "type": "string",
      "description": "Error message if status is failed"
    },
    "statusUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL to poll for status updates"
    },
    "streamUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL for SSE progress stream"
    }
  },
  "$defs": {
    "PersonFinderCandidate": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "matchedRole": {
          "type": "string",
          "description": "Which searched role this candidate matched"
        },
        "confidence": {
          "type": "number",
          "format": "float",
          "description": "Match confidence score (0-1)"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "linkedinUrl": {
          "type": "string",
          "format": "uri"
        },
        "location": {
          "type": "string"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Data sources that found this candidate"
        },
        "hubspotContactId": {
          "type": "string",
          "description": "HubSpot contact ID if created in CRM"
        },
        "enrichmentJobId": {
          "type": "integer",
          "description": "Enrichment job ID if enrich option was enabled"
        }
      }
    }
  }
}