{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api-evangelist.com/schemas/propelauth/propelauth-user-schema.json",
  "title": "PropelAuth User",
  "description": "Schema for a PropelAuth user resource as returned by the backend User API.",
  "type": "object",
  "required": ["user_id", "email"],
  "properties": {
    "user_id": { "type": "string", "format": "uuid", "description": "Stable PropelAuth user identifier." },
    "email": { "type": "string", "format": "email" },
    "email_confirmed": { "type": "boolean" },
    "has_password": { "type": "boolean" },
    "username": { "type": ["string", "null"] },
    "first_name": { "type": ["string", "null"] },
    "last_name": { "type": ["string", "null"] },
    "picture_url": { "type": ["string", "null"], "format": "uri" },
    "properties": { "type": "object", "additionalProperties": true, "description": "Custom user properties." },
    "metadata": { "type": "object", "additionalProperties": true, "description": "Server-side opaque metadata." },
    "locked": { "type": "boolean" },
    "enabled": { "type": "boolean" },
    "mfa_enabled": { "type": "boolean" },
    "can_create_orgs": { "type": "boolean" },
    "created_at": { "type": "integer", "description": "Unix seconds." },
    "last_active_at": { "type": ["integer", "null"], "description": "Unix seconds." },
    "update_password_required": { "type": "boolean" },
    "legacy_user_id": { "type": ["string", "null"] },
    "org_id_to_org_info": {
      "type": "object",
      "description": "Map of org_id to per-org membership info.",
      "additionalProperties": { "$ref": "#/$defs/OrgMembership" }
    }
  },
  "$defs": {
    "OrgMembership": {
      "type": "object",
      "properties": {
        "org_id": { "type": "string", "format": "uuid" },
        "org_name": { "type": "string" },
        "user_role": { "type": "string" },
        "inherited_user_roles_plus_current_role": {
          "type": "array",
          "items": { "type": "string" }
        },
        "user_permissions": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    }
  }
}
