{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/lucca/main/json-schema/lucca-employee-attribute-definition-create-schema.json",
  "title": "employee-attribute-definition",
  "description": "employee-attribute-definition",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lucca-api-2024-11-01.json#/components/schemas/employee-attribute-definition.create",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 3,
      "maxLength": 255,
      "pattern": "^e_",
      "description": "Client-generated identifier. It must start with `e_` and must not be used by any other definition, sub-properties included."
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "schema": {
      "type": "object",
      "description": "JSON schema of the attribute value, expressed by referencing base schemas. Two forms are accepted:\n\n- a single value: `{ \"$ref\": \"/lucca-api/schemas/<type>\" }`;\n- an object value: `{ \"type\": \"object\", \"properties\": { \"<property>\": { \"$ref\": \"/lucca-api/schemas/<type>\" } } }`, where each property is described in `propertyDescriptions`.\n\nThe `schema` returned by GET embeds the referenced schemas: it cannot be sent back as is."
    },
    "propertyDescriptions": {
      "type": [
        "object",
        "null"
      ],
      "description": "Required whenever this definition schema is of type \"object\". \nThis property is a dictionary whose keys are the name of the schema object properties.",
      "additionalProperties": {
        "type": "object",
        "required": [
          "name",
          "sortOrder"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "taxonomy": {
            "anyOf": [
              {
                "$ref": "#/$defs/taxonomy-reference"
              },
              {
                "type": "null"
              }
            ]
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0
          },
          "t9n": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "$ref": "#/$defs/t9n"
              }
            }
          }
        }
      }
    },
    "taxonomy": {
      "title": "taxonomy-reference",
      "description": "Reference to a taxonomy.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "id"
      ]
    },
    "t9n": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "$ref": "#/$defs/t9n"
        }
      }
    },
    "multipleValueHandling": {
      "description": "Behavior regarding multiple extension values per single extended resource. When `null`, then only a single extension can exist for any extended resource. Multiple extensions may be accepted otherwise.\n\nExample: \"employee's children\" would accept multiple value, when \"employee's blood type\" would not.",
      "type": [
        "object",
        "null"
      ],
      "required": [
        "sorting"
      ],
      "properties": {
        "sorting": {
          "description": "In case of multiple extensions per resource, how should the client sort them (direction)?",
          "type": "string",
          "enum": [
            "ascending",
            "descending"
          ]
        },
        "sortingProperty": {
          "description": "Not null for \"object\" schemas, in which case it points to the object property clients should sort extensions on: `extension.value[{sortingProperty}]`.\nNull otherwise, in which case clients are expected to sort on the actual `extension.value`.",
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  },
  "required": [
    "id",
    "name",
    "schema"
  ],
  "$defs": {
    "t9n": {
      "type": [
        "object",
        "null"
      ],
      "title": "Translations",
      "description": "Used for translation purposes. Object is structured as a dictionary whose keys refer to translated properties of the parent object, and whose values are a dictionary of supported languages.\n\nOn the parent object, the translated property value is considered the \"invariant\" translation. It is expected to show this value whenever the user's language has no translation in `t9n`.\n\nLanguages are identified through their RFC 4646 language tag.",
      "properties": {
        "de-DE": {
          "description": "German (Germany)",
          "type": [
            "string",
            "null"
          ]
        },
        "en-US": {
          "description": "English (United States of America)",
          "type": [
            "string",
            "null"
          ]
        },
        "en-GB": {
          "description": "English (Great Britain)",
          "type": [
            "string",
            "null"
          ]
        },
        "es-ES": {
          "description": "Spanish (Spain)",
          "type": [
            "string",
            "null"
          ]
        },
        "fr-FR": {
          "description": "French (France)",
          "type": [
            "string",
            "null"
          ]
        },
        "fr-CH": {
          "description": "French (Switzerland)",
          "type": [
            "string",
            "null"
          ]
        },
        "it-IT": {
          "description": "Italian (Italy)",
          "type": [
            "string",
            "null"
          ]
        },
        "nl-BE": {
          "description": "Dutch (Belgium)",
          "type": [
            "string",
            "null"
          ]
        },
        "nl-NL": {
          "description": "Dutch (Netherlands)",
          "type": [
            "string",
            "null"
          ]
        },
        "pt-PT": {
          "description": "Portuguese (Portugal)",
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "taxonomy-reference": {
      "title": "taxonomy-reference",
      "description": "Reference to a taxonomy.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "taxonomy",
          "readOnly": true
        },
        "url": {
          "type": "string",
          "format": "uri",
          "readOnly": true
        }
      }
    }
  }
}