{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/popp/json-schema/popp-document-type-schema.json",
  "title": "DocumentType",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/popp-documents-api-openapi.yml#/components/schemas/DocumentType",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the document type."
    },
    "organizationId": {
      "type": "string",
      "description": "Identifier of the organization that owns this document type."
    },
    "name": {
      "type": "string",
      "description": "Human-readable name shown to recruiters and candidates."
    },
    "validation": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "CHECK_DOCUMENT_CORNER_INCLUSION",
          "CHECK_NAME_MATCH",
          "CHECK_EXPIRATION_DATE",
          "CHECK_ISSUE_DATE",
          "CHECK_DATE_OF_BIRTH_INCLUSION",
          "CHECK_HOME_ADDRESS_INCLUSION"
        ]
      },
      "description": "Validation checks applied to documents of this type."
    },
    "classificationRules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "INCLUDES_FIELD"
            ]
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "value"
        ]
      },
      "description": "Rules used to recognise documents of this type."
    },
    "validationSettings": {
      "type": "string",
      "description": "JSON-encoded settings that tune the validation checks. Example: {\"validFor\":{\"value\":6,\"unit\":\"MONTHS\"}}."
    },
    "externalId": {
      "type": "string",
      "description": "Customer-controlled stable identifier. Must be unique per organization."
    },
    "isArchived": {
      "type": "boolean",
      "description": "Soft-delete flag. Archived types are not shown in pickers but historical references remain valid."
    },
    "isUsedInCampaign": {
      "type": "boolean",
      "description": "Set when at least one campaign or workflow references this type. Hard delete is blocked while this is true."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "organizationId",
    "name",
    "isArchived",
    "isUsedInCampaign",
    "createdAt",
    "updatedAt"
  ]
}