{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/popp/json-schema/popp-user-schema.json",
  "title": "User",
  "description": "A Popp user with their per-organization access",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/popp-users-api-openapi.yml#/components/schemas/User",
  "type": "object",
  "required": [
    "id",
    "name",
    "email",
    "organizationGroupRole",
    "organizations"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique Popp identifier for the user"
    },
    "name": {
      "type": [
        "string",
        "null"
      ],
      "description": "The user's display name"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "The user's email address"
    },
    "organizationGroupRole": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "ORGANIZATION_GROUP_ADMIN",
        "ORGANIZATION_GROUP_MEMBER"
      ],
      "description": "The user's role within the organization group"
    },
    "organizations": {
      "type": "array",
      "description": "The organizations the user can access, with their role in each",
      "items": {
        "type": "object",
        "required": [
          "organizationId",
          "externalOrganizationId",
          "role"
        ],
        "properties": {
          "organizationId": {
            "type": "string",
            "description": "Popp organization id"
          },
          "externalOrganizationId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your external id for the organization, if one is set"
          },
          "role": {
            "type": "string",
            "enum": [
              "ADMIN",
              "MEMBER"
            ],
            "description": "The user's role in this organization"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}