{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/blackbaud/main/json-schema/blackbaud-code-table-schema.json",
  "title": "CodeTable",
  "description": "A Code Table record.",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blackbaud-code-table-api-openapi.yml#/components/schemas/CodeTable",
  "type": "object",
  "properties": {
    "code_tables_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The unique identifier for the code table."
    },
    "name": {
      "type": [
        "string",
        "null"
      ],
      "description": "The name of the code table."
    },
    "user_defined": {
      "type": "boolean",
      "description": "Indicates whether the code table is user defined."
    },
    "has_short_description": {
      "type": "boolean",
      "description": "Indicates whether the code table supports short description."
    },
    "short_description_length": {
      "type": "integer",
      "description": "The length of the short description.",
      "format": "int32"
    },
    "can_manage": {
      "type": "boolean",
      "description": "Whether the current user can manage this table."
    },
    "category": {
      "$ref": "#/$defs/CodeTableCategory"
    },
    "product_flags": {
      "type": "integer",
      "description": "The product module ID restriction(s).",
      "format": "int32"
    },
    "country_mask": {
      "type": "integer",
      "description": "The countries this code table is valid for.",
      "format": "int32"
    },
    "has_entries": {
      "type": "boolean",
      "description": "Whether the code table has any table entries."
    },
    "is_field_lookup": {
      "type": "boolean",
      "description": "Whether the table is a field lookup table."
    },
    "supports_cleanup": {
      "type": "boolean",
      "description": "Whether the table supports code table cleanup."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "CodeTableCategory": {
      "enum": [
        "All",
        "Biographical",
        "Gift",
        "Action",
        "CFA",
        "Solicitor",
        "Education",
        "Membership",
        "Volunteer",
        "Prospect",
        "Events",
        "WorkplaceGiving"
      ],
      "type": "string",
      "description": "The code table categories available. Certain categories are product module dependent."
    }
  }
}