{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-role-schema.json",
  "title": "Role",
  "description": "A named set of permissions assigned to people at locations.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-roles-api-openapi.yml#/components/schemas/Role",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Display style for the role chip."
    },
    "description": {
      "type": "string",
      "description": "Empty string when not set."
    },
    "builtIn": {
      "type": "boolean",
      "description": "A role that every workspace starts with (Owner, Admin, Finance, Content Manager, Approver, Local Manager, Installer, Viewer). It cannot be deleted. The Owner role's permissions, features and scope cannot be changed; the other built-in roles can be edited."
    },
    "permissions": {
      "anyOf": [
        {
          "type": "string",
          "const": "all"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ],
      "description": "`resource.action` permissions, or `\"all\"` (every permission, now and later)."
    },
    "features": {
      "anyOf": [
        {
          "type": "string",
          "const": "all"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ],
      "description": "Feature keys the role unlocks, or `\"all\"`."
    },
    "scope": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "workspace"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "org-units"
            },
            "orgUnitIds": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The locations (and their subtrees) where the role applies."
            }
          },
          "required": [
            "kind",
            "orgUnitIds"
          ]
        }
      ],
      "description": "Where the role applies: the whole workspace, or only the listed locations."
    },
    "character": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "A decorative label. Not used for access."
    },
    "viewTier": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "simple",
            "team",
            "enterprise"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "The console view people with this role open in, unless they choose their own. `null` = the workspace default. Not used for access."
    },
    "contentScope": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "all",
            "shared"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "What content people with this role see: `all`, or `shared` (only content shared with them plus their own locations' content). `null` = the workspace default (`all`). A person's own setting replaces it."
    },
    "memberCount": {
      "type": "integer",
      "description": "Role assignments that use this role (one per person per location)."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    }
  },
  "required": [
    "id",
    "name",
    "color",
    "description",
    "builtIn",
    "permissions",
    "features",
    "scope",
    "character",
    "viewTier",
    "contentScope",
    "memberCount",
    "createdAt",
    "updatedAt"
  ]
}