{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/salesforce-commerce-cloud/json-schema/salesforce-commerce-cloud-customer-group-search-result-schema.json",
  "title": "CustomerGroupSearchResult",
  "description": "Document representing a customer group search result.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/salesforce-commerce-cloud-customers-api-openapi.yml#/components/schemas/CustomerGroupSearchResult",
  "type": "object",
  "required": [
    "hits"
  ],
  "allOf": [
    {
      "$ref": "#/$defs/PaginatedSearchResult"
    }
  ],
  "properties": {
    "hits": {
      "items": {
        "$ref": "#/$defs/CustomerGroup"
      },
      "type": "array",
      "description": "The sorted array of search hits. Can be empty."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "BoolFilter": {
      "description": "Allows you to combine other filters into (possibly recursive) logical expression trees. A boolean filter is composed of a logical operator (`AND`, `OR`, `NOT`) and a list of filters that the operator relates to. Multiple filters can be negated with a single `NOT` operator, even when the filters are combined with the `AND` operator.",
      "type": "object",
      "properties": {
        "filters": {
          "description": "A list of filters that are logically combined by an operator.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Filter"
          }
        },
        "operator": {
          "description": "The logical operator that is used to combine the filters.",
          "enum": [
            "and",
            "or",
            "not"
          ],
          "type": "string"
        }
      },
      "required": [
        "operator"
      ],
      "additionalProperties": false
    },
    "BoolQuery": {
      "description": "A boolean query allows construction of full logical expression trees that are composed of other queries (usually term queries and text queries). A boolean query has three sets of clauses:\n  \n  - `must`, which combines as an `AND` operator.\n  - `should`, which combines as an `OR` operator.\n  - `must_not`, which combines as a `NOT` operator.\n  \nIf `must`, `mustNot`, or `should` appear in the same boolean query, they are combined logically using the `AND` operator. For example:\n\n    (must-1 AND must-1 AND ...)\n      AND (should-1 OR should-2 OR ...)\n      AND NOT (must_not-1 OR must_not-2 OR ...)\n",
      "type": "object",
      "properties": {
        "must": {
          "description": "List of queries to be evaluated as an `AND` operator.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Query"
          }
        },
        "mustNot": {
          "description": "List of queries to be evaluated as a `NOT` operator.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Query"
          }
        },
        "should": {
          "description": "List of queries to be evaluated as an `OR` operator.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Query"
          }
        }
      },
      "additionalProperties": false
    },
    "CustomerGroup": {
      "required": [
        "id"
      ],
      "type": "object",
      "additionalProperties": {
        "title": "Additional Property Support",
        "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
      },
      "properties": {
        "creationDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date the customer group was created."
        },
        "description": {
          "maxLength": 4000,
          "type": "string",
          "description": "Customer Group description."
        },
        "id": {
          "minLength": 1,
          "maxLength": 256,
          "type": "string",
          "description": "Customer Group id."
        },
        "inDeletion": {
          "type": "boolean",
          "description": "Boolean to indicate if the customer group is marked for deletion."
        },
        "lastModified": {
          "type": "string",
          "format": "date-time",
          "description": "The date the customer group was last modified."
        },
        "memberCount": {
          "type": "integer",
          "format": "int32",
          "description": "Number of members in the customer group"
        },
        "rule": {
          "$ref": "#/$defs/CustomerGroupRule"
        },
        "type": {
          "type": "string",
          "description": "Customer Group Type.",
          "enum": [
            "system",
            "dynamic",
            "static"
          ]
        }
      },
      "description": "Document representing a customer group."
    },
    "CustomerGroupRule": {
      "required": [
        "description"
      ],
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Customer Group Rule description. Describing its conditions in natural language."
        }
      },
      "description": "Customer Group Rule"
    },
    "Field": {
      "description": "Name of the field. Might be a custom field name prefixed with c_.",
      "maxLength": 260,
      "type": "string"
    },
    "Filter": {
      "minProperties": 1,
      "maxProperties": 1,
      "description": "Contains a set of objects that define criteria used to select records. A filter can contain one of the following:\n  * `TermFilter`\n   - Matches records where a field (or fields) exactly matches some simple value (including `null`).\n  * `RangeFilter`\n   - Matches records where a field value lies within a specified range.\n  * `Range2Filter`\n   - Matches records in a specified range across fields.\n  * `QueryFilter`\n   - Matches records based on a query.\n  * `BoolFilter`\n   - Provides filtering of records using a set of filters combined using a logical operator.",
      "type": "object",
      "properties": {
        "boolFilter": {
          "$ref": "#/$defs/BoolFilter"
        },
        "queryFilter": {
          "$ref": "#/$defs/QueryFilter"
        },
        "range2Filter": {
          "$ref": "#/$defs/Range2Filter"
        },
        "rangeFilter": {
          "$ref": "#/$defs/RangeFilter"
        },
        "termFilter": {
          "$ref": "#/$defs/TermFilter"
        }
      },
      "additionalProperties": false
    },
    "FilteredQuery": {
      "description": "Allows to filter the result of a possibly complex query using a possibly complex filter.",
      "type": "object",
      "properties": {
        "filter": {
          "$ref": "#/$defs/Filter"
        },
        "query": {
          "$ref": "#/$defs/Query"
        }
      },
      "required": [
        "filter",
        "query"
      ],
      "additionalProperties": false
    },
    "MatchAllQuery": {
      "description": "Matches all documents (namespace and document type). This query comes in handy if you just want to filter a search result or really do not have any constraints.",
      "type": "object"
    },
    "NestedQuery": {
      "description": "Allows you to query nested documents that are part of a larger document. Say, for example, that you have a main product with variations in one big document, and you want to constrain a search to main products that have variations that match multiple constraints. \n\nA `NestedQuery` is only supported by some Commerce APIs. For more details, see the endpoint descriptions in the API documentation.\n",
      "type": "object",
      "properties": {
        "path": {
          "description": "The path to the nested document.",
          "type": "string",
          "maxLength": 2048
        },
        "query": {
          "$ref": "#/$defs/Query"
        },
        "scoreMode": {
          "description": "Indicates how scores for matching child objects affect the root parent document’s relevance score.",
          "enum": [
            "avg",
            "total",
            "max",
            "none"
          ],
          "type": "string"
        }
      },
      "required": [
        "path",
        "query"
      ],
      "additionalProperties": false
    },
    "Offset": {
      "default": 0,
      "minimum": 0,
      "format": "int32",
      "description": "The zero-based index of the first hit/data to include in the result.",
      "type": "integer"
    },
    "PaginatedResultBase": {
      "description": "Schema defining generic pageable result. Each response schema of a resource requiring pagination should extend this schema. \nIf you use this extend this schema directly, it needs to be defined what data is returned. Allowed names for the data field is `data`.",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ResultBase"
        }
      ],
      "properties": {
        "offset": {
          "$ref": "#/$defs/Offset"
        }
      },
      "required": [
        "limit",
        "offset",
        "total"
      ]
    },
    "PaginatedSearchResult": {
      "description": "Document representing a generic search result. Each search resource should extend this to define what is returned in the `hits`.",
      "properties": {
        "query": {
          "$ref": "#/$defs/Query"
        },
        "sorts": {
          "description": "The sorting that was applied to the result.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Sort"
          }
        },
        "hits": {
          "description": "The sorted array of search hits. Can be empty.",
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      },
      "allOf": [
        {
          "$ref": "#/$defs/PaginatedResultBase"
        }
      ],
      "type": "object",
      "required": [
        "query"
      ],
      "additionalProperties": false
    },
    "Query": {
      "minProperties": 1,
      "maxProperties": 1,
      "description": "A set of objects that define criteria used to select records. A query can contain one of the following:\n* `MatchAllQuery`\n - Matches all documents.\n* `TermQuery`\n - Matches one or more documents against one or more document fields.\n* `TextQuery`\n - Matches text against one or more fields.\n* `BoolQuery`\n - Allows construction of a logical expression of multiple queries.\n* `FilteredQuery`\n - Allows a filter to be applied to a query.\n* `NestedQuery`\n - Allows you to query on nested documents.\n - _Only supported by some Commerce APIs. For more details, see the endpoint descriptions in the API documentation._",
      "type": "object",
      "properties": {
        "boolQuery": {
          "$ref": "#/$defs/BoolQuery"
        },
        "filteredQuery": {
          "$ref": "#/$defs/FilteredQuery"
        },
        "matchAllQuery": {
          "$ref": "#/$defs/MatchAllQuery"
        },
        "nestedQuery": {
          "$ref": "#/$defs/NestedQuery"
        },
        "termQuery": {
          "$ref": "#/$defs/TermQuery"
        },
        "textQuery": {
          "$ref": "#/$defs/TextQuery"
        }
      },
      "additionalProperties": false
    },
    "QueryFilter": {
      "description": "Wraps any query and allows it to be used as a filter.",
      "type": "object",
      "properties": {
        "query": {
          "$ref": "#/$defs/Query"
        }
      },
      "required": [
        "query"
      ]
    },
    "Range2Filter": {
      "description": "Allows you to restrict a search result to hits where a range defined by specified attributes has a certain relationship to a specified range.\n\nThe first range (R1) is defined by a pair of attributes (`fromField` and `toField`) that specify the extent of a range, such as attributes `validFrom` and `validTo`.\n\nThe second range (R2) is defined by `fromValue` and `toValue`.\n\nThe filter mode specifies the method used to compare the two ranges:\n\n* `overlap`: R1 overlaps fully or partially with R2.\n* `containing`: R1 contains R2.\n* `contained`: R1 is contained in R2.\n\nThe range filter supports several value types, and relies on the natural sorting of the value type for range interpretation. Value ranges can be open-ended, but only at one end of the range. You can configure whether the lower bounds and upper bounds are inclusive or exclusive.\n\nA range 2 filter is useful for general restrictions that can be shared between searches (like a static date range) because the filter result is cached in memory. Range filters are not appropriate if the range is expected to be different for every query (for example, if the user controls the date range down to the hour via a UI control). Range filters are inclusive by default.",
      "type": "object",
      "properties": {
        "filterMode": {
          "default": "overlap",
          "description": "Compare mode: overlap, containing, or contained.",
          "enum": [
            "overlap",
            "containing",
            "contained"
          ],
          "type": "string"
        },
        "fromField": {
          "description": "The field name of the field that starts the first range.",
          "allOf": [
            {
              "$ref": "#/$defs/Field"
            }
          ]
        },
        "fromInclusive": {
          "default": true,
          "description": "A flag indicating if the lower bound of the second range is inclusive. To make the lower bound exclusive, set to `false`.",
          "type": "boolean"
        },
        "fromValue": {
          "description": "The lower bound of the second range. If not specified, the range is open-ended with respect to the lower bound. You can't leave both the lower and upper bounds open-ended."
        },
        "toField": {
          "description": "The field name of the field that ends the first range.",
          "allOf": [
            {
              "$ref": "#/$defs/Field"
            }
          ]
        },
        "toInclusive": {
          "default": true,
          "description": "A flag indicating if the upper bound of the second range is inclusive. To make the lower bound exclusive, set to `false`.",
          "type": "boolean"
        },
        "toValue": {
          "description": "The upper bound of the second range. If not specified, the range is open-ended with respect to the upper bound. You can't leave both the upper and lower bounds open-ended."
        }
      },
      "required": [
        "fromField",
        "toField"
      ],
      "additionalProperties": false
    },
    "RangeFilter": {
      "description": "Allows you to restrict a search result to hits that have values for a given attribute that fall within a given value range. The range filter supports several value types and relies on the natural sorting of the value type for range interpretation. Value ranges can be open-ended, but only at one end of the range. You can configure whether the lower bounds and upper bounds are inclusive or exclusive.\n\nA range filter is useful for general restrictions that can be shared between searches (like a static date range) because the filter result is cached in memory. Range filters are not appropriate if the range is expected to be different for every query (for example, if the user controls the date range down to the hour via a UI control). Range filters are inclusive by default.",
      "type": "object",
      "properties": {
        "field": {
          "description": "The search field.",
          "allOf": [
            {
              "$ref": "#/$defs/Field"
            }
          ]
        },
        "from": {
          "oneOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            }
          ],
          "description": "The lower bound of the filter range. If not specified, the range is open-ended with respect to the lower bound. You can't leave both the lower and upper bounds open-ended."
        },
        "fromInclusive": {
          "default": true,
          "description": "A flag indicating if the lower bound of the range is inclusive. To make the lower bound exclusive, set to `false`.",
          "type": "boolean"
        },
        "to": {
          "oneOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            }
          ],
          "description": "The upper bound of the filter range. If not specified, the range is open-ended with respect to the upper bound. You can't leave both the upper and lower bounds open-ended."
        },
        "toInclusive": {
          "default": true,
          "description": "A flag indicating if the upper bound of the range is inclusive. To make the upper bound exclusive, set to `false`.",
          "type": "boolean"
        }
      },
      "required": [
        "field"
      ]
    },
    "ResultBase": {
      "description": "Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. \nAdditionally it needs to be defined what data is returned.",
      "type": "object",
      "required": [
        "limit",
        "total"
      ],
      "properties": {
        "limit": {
          "format": "int32",
          "description": "Maximum records to retrieve per request. The limit with its constraints (minimum, maximum, default) is defined by the request parameter `limit` of the endpoint returning this schema.",
          "type": "integer"
        },
        "total": {
          "$ref": "#/$defs/Total"
        }
      }
    },
    "Sort": {
      "description": "Document representing a sort request. Each API has a different default sort configuration that can be modified in the request.",
      "type": "object",
      "properties": {
        "field": {
          "description": "The name of the field to sort on.",
          "type": "string",
          "maxLength": 256
        },
        "sortOrder": {
          "default": "asc",
          "description": "The sort order to be applied when sorting. When omitted, the default sort order (asc) is used.",
          "enum": [
            "asc",
            "desc"
          ],
          "type": "string"
        }
      },
      "required": [
        "field"
      ],
      "additionalProperties": false
    },
    "TermFilter": {
      "description": "Allows you to restrict a search result to hits that match exactly one of the values configured for the filter. A term filter is useful for general restrictions that can be shared between searches. Use term filters whenever the criteria you filter on is a shared property of multiple searches (for example, like filtering by an order status). Use term filters for fields that have a discrete and small set of values only.",
      "type": "object",
      "properties": {
        "field": {
          "description": "The filter field.",
          "allOf": [
            {
              "$ref": "#/$defs/Field"
            }
          ]
        },
        "operator": {
          "description": "The operator used to compare the field's values with the given values.",
          "enum": [
            "is",
            "one_of",
            "is_null",
            "is_not_null",
            "less",
            "greater",
            "not_in",
            "neq"
          ],
          "type": "string"
        },
        "values": {
          "description": "The filter values.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "field",
        "operator"
      ],
      "additionalProperties": false
    },
    "TermQuery": {
      "description": "A term query matches one or more values against one or more document fields. A document is considered a hit if one of the values matches exactly with at least one of the given fields. The operator `is` can only take one value, while `one_of` can take multiple values. If multiple fields are specified, they are combined using a logical `OR` operator.\n\n**Limitations:**\n\n* The `greater` and `less` operators are not supported under certain conditions. Both operators are permitted unless the API documentation states otherwise.\n* A subset of Commerce APIs handle queries with multiple fields differently. If the query has multiple fields, the query is internally handled as a logical `OR` of `DisjointMaxQueries` (with the dismax matching a value against all fields). The dismax makes sure that a document carrying a single term in multiple fields does not get higher scores than a document matching multiple terms in multiple fields.",
      "type": "object",
      "properties": {
        "fields": {
          "minItems": 1,
          "description": "The document fields that the values are matched against, combined with the operator.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Field"
          }
        },
        "operator": {
          "description": "Returns the operator to use for the term query.",
          "enum": [
            "is",
            "one_of",
            "is_null",
            "is_not_null",
            "less",
            "greater",
            "not_in",
            "neq"
          ],
          "type": "string"
        },
        "values": {
          "description": "The values that the fields are compared against, combined with the operator.",
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "integer"
              }
            ]
          }
        }
      },
      "required": [
        "fields",
        "operator"
      ]
    },
    "TextQuery": {
      "description": "A text query is used to match some text (for example, a search phrase possibly consisting of multiple terms) against one or more fields. When multiple fields are provided, the phrase conceptually forms a logical `OR` over the fields. In this case, the terms of the phrase basically have to match within the text, that would result in concatenating all given fields.",
      "type": "object",
      "properties": {
        "fields": {
          "minItems": 1,
          "description": "The document fields that the search phrase matches against.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Field"
          }
        },
        "searchPhrase": {
          "description": "A search phrase, which can include multiple terms separated by spaces.",
          "type": "string"
        }
      },
      "required": [
        "fields",
        "searchPhrase"
      ],
      "additionalProperties": false
    },
    "Total": {
      "default": 0,
      "minimum": 0,
      "format": "int32",
      "description": "The total number of hits that match the search's criteria. This can be greater than the number of results returned as search results are pagenated.",
      "type": "integer"
    }
  }
}