{
  "description": "This is the interface description of @Consumption.",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://sap.github.io/csn-interop-specification/spec-v1/consumption.schema.json#",
  "title": "Consumption Document",
  "type": "object",
  "definitions": {
    "@Consumption.valueHelpDefinition": {
      "type": "array",
      "description": "The property defines how value helps for this element shall be constructed.\n\nIt allows to associate a (set of) View/Entity that provides the \"Value Help\" for the annotated field or parameter.\nThis is achieved by either referencing the target view/entity of a modelled association or by directly establishing a relationship to view/entity that shall act as a value help provider.",
      "items": {
        "$ref": "#/definitions/@Consumption.ConsumptionValueHelpDefinition"
      },
      "x-extension-targets": [
        "Entity",
        "Type"
      ],
      "title": "@Consumption.valueHelpDefinition"
    },
    "@Consumption.hidden": {
      "type": "boolean",
      "default": true,
      "description": "The annotated element shall be ignored by consumers.",
      "x-extension-targets": [
        "Type"
      ],
      "x-introduced-in-version": "1.2.5",
      "title": "@Consumption.hidden"
    },
    "@Consumption.ConsumptionValueHelpDefinition": {
      "title": "Consumption Value Help Definition",
      "type": "object",
      "properties": {
        "entity": {
          "$ref": "#/definitions/@Consumption.ConsumptionValueHelpDefinition.Entity"
        },
        "additionalBinding": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/@Consumption.ConsumptionValueHelpDefinition.AdditionalBinding"
          },
          "description": "Additional bindings for filtering the value help result list."
        },
        "association": {
          "x-ref-to-doc": {
            "title": "Element Reference",
            "ref": "#/definitions/ElementReference"
          },
          "description": "Reference to the modelled association (in local entity) for which the target view represents the value help providing view or entity for the annotated local field. The on-condition of the association may only contain bindings of the source and target fields that use an equal operator. All these bindings are automatically considered by the value help for both filter and result mappings.\nMutually exclusive to the usage of `valueHelpDefinition.entity`.",
          "$ref": "#/definitions/ElementReference"
        },
        "distinctValues": {
          "type": "boolean",
          "description": "Specifies whether the value help result list shall only contain distinct values for the annotated field or parameter.\nIf set to true all mappings will be used for filtering, but only the value for the field/parameter which the value help was requested for will be returned by the value help.",
          "default": true
        }
      },
      "additionalProperties": false,
      "examples": [
        {
          "entity": {
            "name": "I_ControllingAreaStdVH",
            "element": "ControllingArea"
          }
        },
        {
          "entity": {
            "name": "I_CostCenterStdVH",
            "element": "CostCenter"
          },
          "additionalBinding": [
            {
              "localElement": "ControllingArea",
              "element": "ControllingArea"
            }
          ]
        },
        {
          "association": {
            "=": "to_Airline"
          }
        }
      ]
    },
    "@Consumption.ConsumptionValueHelpDefinition.Entity": {
      "title": "Consumption Value Help Definition",
      "description": "Value help defining view or entity.",
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the value help providing view or entity"
        },
        "element": {
          "type": "string",
          "description": "Name of the field of the value help view or entity, which the annotated local field or parameter is bound to.\n\nMutually exclusive to the usage of `valueHelpDefinition.association`."
        }
      },
      "additionalProperties": false
    },
    "@Consumption.ConsumptionValueHelpDefinition.AdditionalBinding": {
      "title": "Additional Binding",
      "description": "Allows to define additional bindings (besides the ones defined by `valueHelpDefinition.association` or `valueHelpDefinition.entity`) for filtering the value help result list and/or returning values from the selected value help record.",
      "type": "object",
      "properties": {
        "localElement": {
          "type": "string",
          "description": "Field of the current view/entity; mutually exclusive to the usage of `localParameter`."
        },
        "element": {
          "type": "string",
          "description": "Name of the field of the value help view or entity, which the annotated local field or parameter is bound to."
        },
        "usage": {
          "$ref": "#/definitions/@Consumption.ConsumptionValueHelpDefinition.AdditionalBinding.Usage"
        }
      },
      "additionalProperties": false
    },
    "@Consumption.ConsumptionValueHelpDefinition.AdditionalBinding.Usage": {
      "type": "object",
      "description": "The binding may either specify an additional filter-criterion on the value help list (`#FILTER`), or an additional result mapping for the selected value help record (`#RESULT`) or a combination thereof (`#FILTER_AND_RESULT`).\nIf not specified explicitly the usage is `#FILTER_AND_RESULT`.\nIf distinctValues is set to true, additional bindings must specify the usage as `#FILTER`.",
      "properties": {
        "#": {
          "type": "string",
          "description": "Provide the value in `{ \"#\": \"<value>\" }` enum notation.",
          "oneOf": [
            {
              "const": "FILTER",
              "description": "The binding specifies an additional filter-criterion on the value help list."
            },
            {
              "const": "RESULT",
              "description": "The binding specifies an additional result mapping for the selected value help record."
            },
            {
              "const": "FILTER_AND_RESULT",
              "description": "The binding specifies both an additional filter-criterion and an additional result mapping (the default)."
            }
          ],
          "default": "FILTER_AND_RESULT"
        }
      },
      "additionalProperties": false,
      "required": [
        "#"
      ],
      "examples": [
        {
          "#": "FILTER_AND_RESULT"
        }
      ],
      "title": "@Consumption.ConsumptionValueHelpDefinition.AdditionalBinding.Usage"
    },
    "@Consumption.aiHint": {
      "type": "string",
      "description": "Provides a free-text hint for AI consumers (e.g., LLMs or AI agents) on how to use or interpret the annotated element.\n\nThis allows keeping human-readable descriptions (e.g., `@EndUserText`) separate from\nguidance targeted specifically at AI consumers.\n\nThe annotation value MUST NOT be displayed to end users and MUST be filtered when\npublishing metadata externally (e.g., to the SAP API Business Hub public catalog).",
      "examples": [
        "Use this entity to look up current inventory levels by product and warehouse.",
        "This field contains the ISO 4217 currency code, not a currency symbol."
      ],
      "x-extension-targets": [
        "Entity",
        "Type",
        "Service"
      ],
      "x-introduced-in-version": "1.2.6",
      "title": "@Consumption.aiHint"
    }
  }
}