{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/emporix/main/json-schema/emporix-legal-entity-update-schema.json",
  "title": "Legal Entity update payload",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emporix-client-management-openapi.yml#/components/schemas/legalEntityUpdate",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The name of the legal entity."
    },
    "type": {
      "type": "string",
      "enum": [
        "COMPANY",
        "SUBSIDIARY"
      ],
      "description": "The type of the legal entity."
    },
    "parentId": {
      "type": "string",
      "description": "The id of the parent legal entity."
    },
    "accountLimit": {
      "$ref": "#/$defs/accountLimit"
    },
    "legalInfo": {
      "$ref": "#/$defs/legalInfo"
    },
    "customerGroups": {
      "type": "array",
      "description": "The list of customer group IDs assigned to the legal entity.",
      "items": {
        "$ref": "#/$defs/resourceId"
      }
    },
    "entitiesAddresses": {
      "type": "array",
      "description": "The list of location IDs assigned to the legal entity.",
      "items": {
        "$ref": "#/$defs/resourceId"
      }
    },
    "approvalGroup": {
      "type": "array",
      "description": "The list of customer assignment IDs of an approval user group of the legal entity.",
      "items": {
        "$ref": "#/$defs/resourceId"
      }
    },
    "restrictions": {
      "$ref": "#/$defs/restrictions"
    },
    "metadata": {
      "$ref": "#/$defs/metadataUpdate"
    },
    "mixins": {
      "type": "object",
      "description": "Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.",
      "additionalProperties": true
    }
  },
  "required": [
    "name",
    "type"
  ],
  "$defs": {
    "accountLimit": {
      "title": "Account Limit additional information",
      "type": "object",
      "properties": {
        "currency": {
          "type": "string",
          "description": "The account limit currency."
        },
        "value": {
          "type": "number",
          "description": "The purchasing limit for account in the legal entity.",
          "minimum": 0
        }
      }
    },
    "legalInfo": {
      "title": "Legal Entity additional information",
      "type": "object",
      "properties": {
        "legalName": {
          "type": "string",
          "description": "The legal name of the entity."
        },
        "registrationDate": {
          "type": "string",
          "description": "The registration date of the legal entity in the ISO 8601 format, e.g. 2020-04-30T04:00:00.000Z."
        },
        "taxRegistrationNumber": {
          "type": "string",
          "description": "The tax registration number of the legal entity."
        },
        "registrationAgency": {
          "type": "string",
          "description": "The registration agency of the legal entity."
        },
        "countryOfRegistration": {
          "type": "string",
          "description": "The country in which the legal entity has been registered. The country needs to be defined and active in the Country Service."
        },
        "registrationId": {
          "type": "string",
          "description": "The unique identifier of the legal entity registration."
        }
      }
    },
    "metadataUpdate": {
      "type": "object",
      "properties": {
        "version": {
          "minimum": 1,
          "type": "integer",
          "description": "Version of the document."
        },
        "mixins": {
          "type": "object",
          "description": "Links to the mixin schemas. A map where the keys represent mixins set attributes and the values represent url to a schema for a particular set.",
          "additionalProperties": true
        }
      }
    },
    "resourceId": {
      "title": "Resource",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Id of a resource."
        }
      }
    },
    "restrictions": {
      "title": "Restriction",
      "type": [
        "array",
        "null"
      ],
      "maximum": 1,
      "description": "List of restrictions which determine who can view or manage the Legal Entity.",
      "items": {
        "type": "string",
        "description": "Access control identifier that determines who can view or manage the Legal Entity.\n\n**Purpose**: Restricts Legal Entity visibility based on scope permissions. Only users/applications \nwith matching restrictions scopes can access Legal Entities with a specific restrictions value.\n\n**Access Control**:\n- *Reading*: Users can only query and view Legal Entities whose `restrictions` value matches one of their authorized restrictions.\n\n**Validation**: The value must exist in the tenant's configured list of valid restrictions.\n"
      }
    }
  }
}