{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/craaft-io/json-schema/craaft-io-member-schema.json",
  "title": "Member",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/craaft-io-members-api-openapi.yml#/components/schemas/Member",
  "type": "object",
  "required": [
    "userId",
    "email",
    "name",
    "role",
    "avatarUrl",
    "joinedAt"
  ],
  "properties": {
    "userId": {
      "type": "string",
      "format": "uuid"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "name": {
      "type": "string"
    },
    "role": {
      "type": "string",
      "enum": [
        "owner",
        "admin",
        "member"
      ]
    },
    "avatarUrl": {
      "type": "string",
      "description": "Empty when no upload; otherwise /api/v1/users/{id}/avatar"
    },
    "joinedAt": {
      "type": "string",
      "format": "date-time"
    },
    "boardAccess": {
      "type": "array",
      "description": "Explicit board grants the caller is allowed to see. Omitted when\nthe row is a workspace owner/admin (implicit access to every\nboard) OR when a non-admin caller is reading someone else's row.\nEmpty array means \"this member has no explicit grants\".\n",
      "items": {
        "$ref": "#/$defs/BoardAccess"
      }
    }
  },
  "$defs": {
    "BoardAccess": {
      "type": "object",
      "required": [
        "projectId",
        "name",
        "role"
      ],
      "properties": {
        "projectId": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "maxLength": 200
        },
        "role": {
          "type": "string",
          "enum": [
            "admin",
            "contributor"
          ]
        }
      }
    }
  }
}