{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/api-evangelist/retool/json-schema/retool-user-schema.json",
  "title": "Retool User",
  "description": "A user account in a Retool organization with role-based access control.",
  "type": "object",
  "required": ["id", "email"],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "The unique UUID identifier for the user."
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "The user's email address, unique within the organization."
    },
    "firstName": {
      "type": "string",
      "description": "The user's first name."
    },
    "lastName": {
      "type": "string",
      "description": "The user's last name."
    },
    "isAdmin": {
      "type": "boolean",
      "description": "Whether the user has administrator privileges.",
      "default": false
    },
    "isDisabled": {
      "type": "boolean",
      "description": "Whether the user account is disabled.",
      "default": false
    },
    "userType": {
      "type": "string",
      "description": "The user type determining default access level.",
      "enum": ["default", "endUser"],
      "default": "default"
    },
    "groups": {
      "type": "array",
      "description": "Groups the user belongs to.",
      "items": {
        "type": "object",
        "properties": {
          "id": { "type": "integer" },
          "name": { "type": "string" }
        }
      }
    },
    "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."
    }
  }
}
