{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/prismatic/refs/heads/main/json-schema/user.json",
  "title": "Prismatic User",
  "description": "A user represents a person who interacts with Prismatic, either as an organization team member or a customer user.",
  "type": "object",
  "required": ["id", "email", "name"],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the user"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "Email address of the user"
    },
    "name": {
      "type": "string",
      "description": "Full name of the user"
    },
    "avatarUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL of the user avatar image"
    },
    "externalId": {
      "type": "string",
      "description": "External identifier to map the user to your own system"
    },
    "role": {
      "type": "object",
      "description": "Role assigned to the user",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "enum": ["Owner", "Admin", "Member", "Guest", "Third Party"]
        }
      }
    },
    "customer": {
      "$ref": "customer.json",
      "description": "The customer this user belongs to, if a customer user"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the user was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the user was last updated"
    }
  }
}
