{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/adobe/json-schema/adobe-criteria-category-schema.json",
  "title": "CriteriaCategory",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/adobe-target-recommendations-openapi.yml#/components/schemas/CriteriaCategory",
  "allOf": [
    {
      "$ref": "#/$defs/CriteriaMin"
    },
    {
      "type": "object",
      "properties": {
        "aggregation": {
          "type": "string",
          "enum": [
            "NONE",
            "AGGREGATE",
            "ALL_OR_NOTHING"
          ],
          "default": "NONE",
          "description": "Whether recommendations should be shown solely based on the key (`NONE`) or visitor's behavioral history with\nrespect to the key (`AGGREGATE`, `ALL_OR_NOTHING`).\n  - `NONE` implies no aggregation, to only show recommendations for the given key.\n  - `AGGREGATE` begins with recommendations for the given key, favorite category in this instance, then continues\n    to next favorite of visitor's favorite categories until the design is filled.\n  - `ALL_OR_NOTHING` is similar to aggregation but the aggregation only happens if the given key, favorite\n    category in this instance, has enough recommendations to fill the design. If the key does not have enough\n    recommendations, next favorite category in visitor's favorite categories is considered sequentially until the\n    design is filled.\n\nIf the key is current category, only `NONE` is valid. For key as favorite category, all aggregation options are\navailable.\n"
        },
        "backupDisabled": {
          "type": "boolean",
          "default": false,
          "description": "Whether backup recommendations are disabled when criteria does not generate enough recommendations."
        },
        "backupInclusionFilteringEnabled": {
          "type": "boolean",
          "default": true,
          "description": "Whether inclusion rules on the criteria should be applied to backup recommendations."
        },
        "configuration": {
          "$ref": "#/$defs/CriteriaCategoryConfiguration"
        },
        "criteriaGroup": {
          "type": "string",
          "enum": [
            "CATEGORY"
          ],
          "readOnly": true
        },
        "daysCount": {
          "type": "string",
          "enum": [
            "ONE_DAY",
            "TWO_DAYS",
            "ONE_WEEK",
            "TWO_WEEKS",
            "ONE_MONTH",
            "TWO_MONTHS"
          ],
          "description": "Time range of historical visitor behavioral data to consider for generating recommendations.\n\nThis field can not be used together with `hoursCount`\n"
        },
        "hoursCount": {
          "type": "integer",
          "description": "Time range of historical visitor behavioral data to consider for generating recommendations.\n\nThis field can not be used together with `daysCount`. Only allowed value `6`\n"
        },
        "enableCaching": {
          "type": "boolean",
          "default": false,
          "deprecated": true,
          "readOnly": true
        },
        "excludePurchases": {
          "type": "boolean",
          "default": false,
          "description": "Whether items that were previously purchased by the visitor should be excluded from recommendations."
        },
        "key": {
          "type": "string",
          "enum": [
            "CURRENT",
            "FAVORITE"
          ],
          "description": "Recommendation key. Values:\n\n- `CURRENT`: The category of the currently viewed item.\n- `FAVORITE`: The category among visitor's categories with highest score. The recommendations are determined by\n  the categories that have been most viewed. The score is determined by recency/frequency: 10 points for first\n  category view, 5 points for every subsequent view.\n"
        },
        "minInventory": {
          "type": "integer",
          "format": "int32",
          "minimum": 0,
          "description": "Minimum number of pieces needed in stock for an item to be considered for recommendaton."
        },
        "partialDesignAllowed": {
          "type": "boolean",
          "default": false,
          "description": "Whether design be shown when the number of recommendations are less than item slots in the design."
        },
        "type": {
          "type": "string",
          "enum": [
            "BOUGHT",
            "VIEWED"
          ],
          "description": "Recommendation logic. Values:\n\n  - `BOUGHT`: Top sold items.\n  - `VIEWED`: Most viewed items.\n"
        }
      },
      "required": [
        "key",
        "type"
      ]
    }
  ],
  "$defs": {
    "AlgorithmRankingRule": {
      "type": "object",
      "properties": {
        "matcher": {
          "$ref": "#/$defs/Matcher"
        },
        "weighting": {
          "type": "integer",
          "format": "int32",
          "minimum": 0,
          "maximum": 4
        }
      }
    },
    "CriteriaCategoryConfiguration": {
      "allOf": [
        {
          "$ref": "#/$defs/CriteriaConfiguration"
        },
        {
          "type": "object",
          "properties": {
            "pastBehaviorOrdinal": {
              "type": "integer",
              "format": "int32"
            }
          }
        }
      ]
    },
    "CriteriaConfiguration": {
      "type": "object",
      "properties": {
        "inclusionRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InclusionMatcher"
          },
          "maxItems": 1000,
          "description": "Filtering rules to narrow the items to be displayed as recommendations. Inclusion rules are conjunctive and all rules\nmust be met to include an item in a recommendation. [More info](https://marketing.adobe.com/resources/help/en_US/target/recs/t_create_new_algorithm.html).\n"
        },
        "priceRange": {
          "$ref": "#/$defs/CriteriaPriceRange"
        },
        "rankingRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AlgorithmRankingRule"
          },
          "maxItems": 1000,
          "description": "Rules for attribute weighting. Attribute weighting can be used to \"nudge\" the algorithm so certain items are more\nlikely to be shown. [More info](https://marketing.adobe.com/resources/help/en_US/target/recs/t_create_new_algorithm.html).\n"
        }
      },
      "description": "Object containing inclusion rules, attribute weighting, price filter, and some more configuration options specific to the criteria group."
    },
    "CriteriaMin": {
      "type": "object",
      "properties": {
        "criteriaGroup": {
          "type": "string",
          "readOnly": true
        },
        "criteriaTitle": {
          "type": "string",
          "maxLength": 250,
          "description": "Displayed in the design using variable `$criteria.title`."
        },
        "id": {
          "type": "integer",
          "format": "int64",
          "readOnly": true
        },
        "name": {
          "type": "string",
          "maxLength": 250,
          "description": "Unique name of the criteria."
        },
        "description": {
          "type": "string",
          "maxLength": 1000
        },
        "lastModifiersName": {
          "type": "string",
          "readOnly": true
        },
        "lastModifiersEmail": {
          "type": "string",
          "readOnly": true
        },
        "lastModified": {
          "type": "string",
          "readOnly": true,
          "format": "date-time",
          "description": "The time in UTC when the criteria was last modified."
        }
      },
      "required": [
        "name"
      ]
    },
    "CriteriaPriceRange": {
      "type": "object",
      "properties": {
        "max": {
          "type": "number",
          "format": "double"
        },
        "min": {
          "type": "number",
          "format": "double"
        }
      },
      "description": "Price rule filter for items to be considered in recommendations."
    },
    "InclusionMatcher": {
      "type": "object",
      "properties": {
        "attribute": {
          "type": "string",
          "maxLength": 100
        },
        "highRange": {
          "type": "string"
        },
        "lowRange": {
          "type": "string"
        },
        "operation": {
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/SourceAttribute"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 250
          },
          "minItems": 1,
          "maxItems": 1000
        }
      },
      "required": [
        "attribute",
        "operation"
      ]
    },
    "Matcher": {
      "type": "object",
      "properties": {
        "attribute": {
          "type": "string",
          "maxLength": 100
        },
        "operation": {
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/SourceAttribute"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 250
          },
          "minItems": 1,
          "maxItems": 1000
        }
      },
      "required": [
        "attribute",
        "operation"
      ]
    },
    "SourceAttribute": {
      "type": "object",
      "properties": {
        "defaultValue": {
          "type": "string"
        },
        "excludeAllWhenEmpty": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "type"
      ]
    }
  }
}