{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/emporix/json-schema/emporix-price-list-schema.json",
  "title": "priceList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emporix-price-lists-api-openapi.yml#/components/schemas/priceList",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier of the price that belongs to a price list, generated when the price is created and added to the price list."
        },
        "name": {
          "type": "object",
          "description": "Price list's name, expressed as a map of translations."
        }
      }
    },
    {
      "$ref": "#/$defs/priceListCore"
    },
    {
      "type": "object",
      "properties": {
        "metadata": {
          "allOf": [
            {
              "$ref": "#/$defs/metadata"
            },
            {
              "type": "object",
              "properties": {
                "mixins": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Mixins schemas"
                }
              }
            }
          ]
        }
      }
    }
  ],
  "$defs": {
    "currency": {
      "type": "string",
      "title": "currency",
      "pattern": "[A-Z]{3}",
      "description": "Currency code, compliant with the ISO 4217 standard."
    },
    "dateValidity": {
      "type": "object",
      "description": "Date range in which the object is valid.",
      "properties": {
        "from": {
          "type": "string",
          "description": "Date from which the object is valid, compliant with the ISO 8601 standard."
        },
        "to": {
          "type": "string",
          "description": "Date to which the object is valid, compliant with the ISO 8601 standard."
        }
      }
    },
    "metadata": {
      "type": "object",
      "properties": {
        "createdAt": {
          "description": "Date and time when the price was created.",
          "type": "string"
        },
        "modifiedAt": {
          "description": "Date and time when the price was last modified.",
          "type": "string"
        },
        "version": {
          "minimum": 1,
          "type": "integer",
          "description": "Version of the price object. If provided optimistic locking will be enabled and it has to match version in the database"
        }
      }
    },
    "priceListCore": {
      "title": "priceListCore",
      "type": "object",
      "properties": {
        "currency": {
          "allOf": [
            {
              "$ref": "#/$defs/currency"
            }
          ]
        },
        "countries": {
          "description": "Codes of countries to which the price list applies, as defined in the Country Service.\n\n**Note** If not specified, the price list will be applicable to users from all locations.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "regions": {
          "description": "List of the regions to which the price list applies.\n\n**Note** If not specified, the price list will be applicable to users from all locations.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "customerGroups": {
          "description": "List of customer groups IDs for which the price list is valid. If not specified, the price list is applicable to all customer groups.\n\n**Note**: Customer groups cannot be provided if there is a legal entity specified for the price list.\n\n**The `customerGroups` field is in preview mode** - the system does not fully operate on the customer groups concept yet.",
          "type": "array",
          "items": {
            "allOf": [
              {}
            ],
            "type": "string"
          }
        },
        "legalEntityId": {
          "description": "ID of the legal entity to which the price list applies.\n**Note**: Price list assigned to legal entity is also applicable for all the subsidiaries.",
          "type": "string"
        },
        "siteCode": {
          "description": "Code of the site to which the price list applies.",
          "type": "string"
        },
        "validity": {
          "allOf": [
            {
              "$ref": "#/$defs/dateValidity"
            }
          ]
        },
        "mixins": {
          "type": "object",
          "description": "Map of custom price lists attributes.\n",
          "additionalProperties": true
        }
      }
    }
  }
}