{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-workspace-invite-schema.json",
  "title": "WorkspaceInvite",
  "description": "Workspace invitation record. Tokens are 32-byte hex (64 chars); they expire after\n7 days from creation. Accepted invites have `acceptedAt` set.\n",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-workspaces-api-openapi.yml#/components/schemas/WorkspaceInvite",
  "type": "object",
  "required": [
    "id",
    "workspaceId",
    "email",
    "role",
    "token",
    "expiresAt",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "Email lowercased server-side."
    },
    "role": {
      "type": "string",
      "enum": [
        "admin",
        "member",
        "viewer"
      ]
    },
    "invitedBy": {
      "type": "string",
      "format": "uuid",
      "description": "Inviter's `userId`."
    },
    "token": {
      "type": "string",
      "minLength": 64,
      "maxLength": 64,
      "description": "32-byte hex token (64 hex chars). Used in `/invites/{token}` URLs."
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "Invite expires 7 days after creation."
    },
    "acceptedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "ISO-8601 timestamp when the invite was accepted, or `null` if pending."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}