{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paypal/json-schema/paypal-feature-request-schema.json",
  "title": "FeatureRequest",
  "description": "Request payload for creating a new feature. Features represent entitleable capabilities that can be assigned to customers through plans.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paypal-features-api-openapi.yml#/components/schemas/FeatureRequest",
  "type": "object",
  "required": [
    "code"
  ],
  "allOf": [
    {
      "$ref": "#/$defs/FeatureBase"
    },
    {
      "type": "object",
      "properties": {
        "privileges": {
          "type": "array",
          "description": "List of configurable privileges that define what aspects of this feature can be customized when creating entitlements. Each privilege can have different values assigned in different plans or subscriptions. Can be empty if the feature is simply on/off.",
          "items": {
            "$ref": "#/$defs/FeaturePrivilegeBase"
          }
        }
      }
    }
  ],
  "$defs": {
    "FeatureBase": {
      "type": "object",
      "description": "Core properties that define a feature - a capability or functionality that can be entitled to customers through plans or subscriptions",
      "properties": {
        "code": {
          "type": "string",
          "description": "Unique identifier for the feature across your entire system. This code is used when creating entitlements and should represent the feature's function (e.g., 'seats', 'api-access', 'API_STORAGE'). Allows alphanumeric characters, underscores, and hyphens.",
          "maxLength": 255,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "name": {
          "type": "string",
          "description": "Customer-facing name of the feature that clearly describes what functionality or capability it provides. This name appears in billing interfaces and customer portals.",
          "maxLength": 255
        },
        "description": {
          "type": "string",
          "description": "Detailed explanation of what this feature provides, its limitations, and how it affects the customer's experience.",
          "maxLength": 600
        }
      }
    },
    "FeaturePrivilegeBase": {
      "type": "object",
      "description": "Defines a configurable aspect of a feature that can be assigned different values when entitled to plans or subscriptions",
      "required": [
        "code"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Unique identifier for the privilege within its parent feature. Used as a key when assigning values to this privilege in entitlements. Allows alphanumeric characters, underscores, and hyphens.",
          "maxLength": 255,
          "pattern": "^[a-zA-Z0-9_-]+$"
        },
        "name": {
          "type": "string",
          "description": "Human-friendly display name for the privilege shown in user interfaces. This helps users understand what aspect of the feature is being configured.",
          "maxLength": 255
        },
        "value_type": {
          "$ref": "#/$defs/PrivilegeValueType"
        },
        "config": {
          "$ref": "#/$defs/PrivilegeConfig"
        }
      }
    },
    "PrivilegeConfig": {
      "type": "object",
      "description": "Additional configuration for privileges that require constraints or options. Currently used for 'select' type privileges to define allowed values.",
      "properties": {
        "select_options": {
          "type": "array",
          "description": "Defines the allowed values when value_type is 'select'. When creating entitlements, only these predefined options can be assigned. Useful for features like SSO providers, regions, or service tiers.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "PrivilegeValueType": {
      "type": "string",
      "description": "Defines the data type that this privilege accepts when being assigned values in entitlements. 'INTEGER' for numeric limits, 'BOOLEAN' for on/off toggles, 'STRING' for text values, 'SELECT' for predefined options.",
      "enum": [
        "STRING",
        "BOOLEAN",
        "INTEGER",
        "SELECT"
      ],
      "default": "STRING"
    }
  }
}