{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cavuno-com/json-schema/cavuno-com-reconcile-candidate-body-schema.json",
  "title": "ReconcileCandidateBody",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cavuno-com-candidates-api-openapi.yml#/components/schemas/ReconcileCandidateBody",
  "type": "object",
  "properties": {
    "sourceKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "pattern": "^[a-z0-9._-]+$",
      "description": "Opaque caller-chosen identifier for the membership system this write comes from (1–64 characters, `[a-z0-9._-]`). Identifies the source, not the person, and must stay stable: changing it treats the caller as a new source and cannot update an existing link."
    },
    "externalMemberId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "The member id in the caller's system (1–256 characters). Sent in the body, never the URL: request paths land in logs and traces. Together with `sourceKey` this is the idempotent membership-sync key."
    },
    "sourceRevision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Monotonically increasing revision per member, typically the source system's change timestamp in milliseconds. An equal revision is an idempotent no-op (`unchanged`); a lower revision is rejected as stale so a delayed write can never resurrect stale profile data or reactivate a deactivated account. Revisions above 2^53-1 are rejected."
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "The candidate's email address. Used to create or link the Board user for this membership source."
    },
    "displayName": {
      "type": "string",
      "minLength": 1,
      "description": "The candidate's display name."
    },
    "profile": {
      "allOf": [
        {
          "$ref": "#/$defs/CandidateProfileProjection"
        },
        {
          "description": "Optional bounded profile projection, the same shape as `PUT /candidates/{id}/profile`. Absent keys are left unchanged; `null` on a scalar clears it; a provided collection array replaces that collection wholesale. Pair with `candidate.profile.updated` and `GET /candidates/{id}/profile` for notification-plus-pull."
        }
      ]
    },
    "active": {
      "type": "boolean",
      "description": "When `false`, deactivates the candidate for this membership source (sign-in disabled, sessions revoked, profile hidden from talent surfaces). When `true`, lifts only that membership deactivation; the candidate signs in again to establish a new session. `true` never lifts an operator deactivation from `POST /candidates/{id}/deactivate` or the dashboard Ban, so `deactivatedAt` stays set until the operator reactivates. Profile and application history are preserved either way."
    }
  },
  "required": [
    "sourceKey",
    "externalMemberId",
    "sourceRevision",
    "email",
    "displayName",
    "active"
  ],
  "additionalProperties": false,
  "$defs": {
    "CandidateProfileEducationProjection": {
      "type": "object",
      "properties": {
        "institutionName": {
          "type": "string",
          "minLength": 1,
          "description": "Institution name."
        },
        "institutionUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "Institution URL."
        },
        "degree": {
          "type": [
            "string",
            "null"
          ],
          "description": "Degree awarded."
        },
        "fieldOfStudy": {
          "type": [
            "string",
            "null"
          ],
          "description": "Field of study."
        },
        "grade": {
          "type": [
            "string",
            "null"
          ],
          "description": "Grade or GPA."
        },
        "activitiesAndSocieties": {
          "type": [
            "string",
            "null"
          ],
          "description": "Activities and societies."
        },
        "startDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "Start date."
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "End date."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Education description."
        },
        "sortOrder": {
          "type": "integer",
          "description": "Display order, lower first."
        }
      },
      "required": [
        "institutionName",
        "sortOrder"
      ],
      "additionalProperties": false
    },
    "CandidateProfileExperienceProjection": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "description": "Job title."
        },
        "companyName": {
          "type": "string",
          "minLength": 1,
          "description": "Employer name."
        },
        "companyUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "Employer URL."
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "description": "Role location."
        },
        "employmentType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Employment type."
        },
        "locationType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Location type."
        },
        "foundVia": {
          "type": [
            "string",
            "null"
          ],
          "description": "How the role was found."
        },
        "startDate": {
          "type": "string",
          "minLength": 1,
          "description": "Start date."
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "End date."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Role description."
        },
        "experienceSkills": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          },
          "maxItems": 50,
          "description": "Per-role skills; replaced with the row."
        },
        "sortOrder": {
          "type": "integer",
          "description": "Display order, lower first."
        }
      },
      "required": [
        "title",
        "companyName",
        "startDate",
        "sortOrder"
      ],
      "additionalProperties": false
    },
    "CandidateProfileLanguageProjection": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Language name."
        },
        "proficiency": {
          "type": "string",
          "minLength": 1,
          "description": "Proficiency label."
        },
        "sortOrder": {
          "type": "integer",
          "description": "Display order, lower first."
        }
      },
      "required": [
        "name",
        "proficiency",
        "sortOrder"
      ],
      "additionalProperties": false
    },
    "CandidateProfileProjection": {
      "type": "object",
      "properties": {
        "headline": {
          "type": [
            "string",
            "null"
          ],
          "description": "Absent key leaves the stored headline unchanged; `null` clears it."
        },
        "bio": {
          "type": [
            "string",
            "null"
          ],
          "description": "Absent key leaves the stored bio unchanged; `null` clears it."
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "description": "Absent key leaves the stored location unchanged; `null` clears it."
        },
        "countryCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "Absent key leaves the stored country code unchanged; `null` clears it. Ignored without an error while the candidate has a home place that this request keeps (a changed `location` removes it): the country code is then that place's country."
        },
        "skills": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxItems": 200,
          "description": "Absent key leaves the stored skills unchanged. Providing an array replaces the collection wholesale (empty array clears). Maximum 200 rows."
        },
        "languages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CandidateProfileLanguageProjection"
          },
          "maxItems": 50,
          "description": "Absent key leaves the stored languages unchanged. Providing an array replaces the collection wholesale (empty array clears). Maximum 50 rows."
        },
        "experience": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CandidateProfileExperienceProjection"
          },
          "maxItems": 50,
          "description": "Absent key leaves the stored experience unchanged. Providing an array replaces the collection wholesale (empty array clears). Maximum 50 rows."
        },
        "education": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CandidateProfileEducationProjection"
          },
          "maxItems": 50,
          "description": "Absent key leaves the stored education unchanged. Providing an array replaces the collection wholesale (empty array clears). Maximum 50 rows."
        }
      },
      "additionalProperties": false
    }
  }
}