{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/emporix/main/json-schema/emporix-category-tree-schema.json",
  "title": "CategoryTree",
  "description": "Definition of category tree",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emporix-category-tree-openapi.yml#/components/schemas/CategoryTree",
  "type": "object",
  "required": [
    "id",
    "localizedName",
    "name",
    "position",
    "published"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Category unique identifier generated when the category is created."
    },
    "name": {
      "type": "string",
      "description": "Category name in tenant default language.",
      "deprecated": true
    },
    "description": {
      "type": "string",
      "description": "Description in tenant default language.",
      "deprecated": true
    },
    "code": {
      "type": "string",
      "description": "Unique category identifier defined by the tenant."
    },
    "localizedName": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Localized category name as a map of translations."
    },
    "localizedDescription": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Localized category description as a map of translations."
    },
    "localizedSlug": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Provides localized category name or code without diacritics for the URL."
    },
    "validity": {
      "$ref": "#/$defs/Validity",
      "description": "Category validity."
    },
    "position": {
      "type": "integer",
      "format": "int32",
      "description": "Category position in relation to sibling categories."
    },
    "published": {
      "type": "boolean",
      "description": "Flag indicating whether the category has been published."
    },
    "ecn": {
      "type": "array",
      "description": "List of external category numbers (ECNs) unique for each category.",
      "items": {
        "type": "string"
      }
    },
    "subcategories": {
      "type": "array",
      "description": "Subcategories of this category.",
      "items": {
        "$ref": "#/$defs/CategoryTree"
      }
    }
  },
  "$defs": {
    "CategoryTree": {
      "type": "object",
      "description": "Definition of category tree",
      "required": [
        "id",
        "localizedName",
        "name",
        "position",
        "published"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Category unique identifier generated when the category is created."
        },
        "name": {
          "type": "string",
          "description": "Category name in tenant default language.",
          "deprecated": true
        },
        "description": {
          "type": "string",
          "description": "Description in tenant default language.",
          "deprecated": true
        },
        "code": {
          "type": "string",
          "description": "Unique category identifier defined by the tenant."
        },
        "localizedName": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Localized category name as a map of translations."
        },
        "localizedDescription": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Localized category description as a map of translations."
        },
        "localizedSlug": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Provides localized category name or code without diacritics for the URL."
        },
        "validity": {
          "$ref": "#/$defs/Validity",
          "description": "Category validity."
        },
        "position": {
          "type": "integer",
          "format": "int32",
          "description": "Category position in relation to sibling categories."
        },
        "published": {
          "type": "boolean",
          "description": "Flag indicating whether the category has been published."
        },
        "ecn": {
          "type": "array",
          "description": "List of external category numbers (ECNs) unique for each category.",
          "items": {
            "type": "string"
          }
        },
        "subcategories": {
          "type": "array",
          "description": "Subcategories of this category.",
          "items": {
            "$ref": "#/$defs/CategoryTree"
          }
        }
      }
    },
    "Validity": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string",
          "description": "Date and time from which the category is valid compliant with the ISO 8601 standard.",
          "format": "date-time"
        },
        "to": {
          "type": "string",
          "description": "Date and time to which the category is valid compliant with the ISO 8601 standard.",
          "format": "date-time"
        }
      }
    }
  }
}