{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "/schemas/3.1.0-beta.2/core/feature-requirement.json",
  "title": "Feature Requirement",
  "description": "A feature-based requirement — a reusable predicate over a feature value. Used by property list filters today; designed for reuse in other surfaces (audience filters, creative gates) in future versions. Use min_value/max_value for quantitative features, allowed_values for binary/categorical features.",
  "type": "object",
  "properties": {
    "feature_id": {
      "type": "string",
      "description": "Feature to evaluate (discovered via get_adcp_capabilities)"
    },
    "min_value": {
      "type": "number",
      "description": "Minimum numeric value required (for quantitative features)"
    },
    "max_value": {
      "type": "number",
      "description": "Maximum numeric value allowed (for quantitative features)"
    },
    "allowed_values": {
      "type": "array",
      "description": "Values that pass the requirement (for binary/categorical features)",
      "items": {},
      "minItems": 1
    },
    "if_not_covered": {
      "type": "string",
      "enum": ["exclude", "include"],
      "default": "exclude",
      "description": "How to handle properties where this feature is not covered. 'exclude' (default): property is removed from the list. 'include': property passes this requirement (fail-open)."
    },
    "policy_id": {
      "type": "string",
      "description": "Optional attribution — when this requirement encodes a specific buyer-chosen threshold authorized by a policy, policy_id references the authorizing PolicyEntry. Producers populate when the mechanism exists because of a specific policy (e.g., max_value: 15 on audience_children_composition because of uk_hfss); do NOT populate when the requirement is a general filter unrelated to any policy. Governance findings echo this policy_id when emitting denials traced to the requirement. See /docs/governance/policy-attribution.",
      "$comment": "x-entity deliberately omitted — a PolicyEntry reference can resolve to either a governance_registry_policy or a governance_inline_policy depending on the authorizing entry's source. See issue #2685."
    }
  },
  "required": ["feature_id"],
  "additionalProperties": false
}
