{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/rbac/refs/heads/main/json-schema/rbac-role.json",
  "title": "RBAC Role",
  "description": "A named collection of permissions that can be assigned to users in a Role-Based Access Control system.",
  "type": "object",
  "required": ["id", "name"],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the role."
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the role (e.g., 'admin', 'editor', 'viewer')."
    },
    "description": {
      "type": "string",
      "description": "Description of the role's purpose and scope."
    },
    "permissions": {
      "type": "array",
      "description": "List of permission identifiers granted by this role.",
      "items": { "type": "string" }
    },
    "parents": {
      "type": "array",
      "description": "Parent roles this role inherits permissions from (role hierarchy).",
      "items": { "type": "string" }
    },
    "scope": {
      "type": "string",
      "description": "Scope of the role (e.g., global, organization, project)."
    },
    "created": {
      "type": "string",
      "format": "date-time"
    },
    "modified": {
      "type": "string",
      "format": "date-time"
    }
  }
}
