{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flowra-dev/json-schema/flowra-dev-external-user-response-dto-paginated-response-schema.json",
  "title": "ExternalUserResponseDtoPaginatedResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flowra-dev-external-users-api-openapi.yml#/components/schemas/ExternalUserResponseDtoPaginatedResponse",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean",
      "description": "Success status"
    },
    "message": {
      "type": "string",
      "description": "Response message"
    },
    "data": {
      "description": "Array of items",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID of the external user"
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name of the external user"
          },
          "projectId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Project ID"
          },
          "source": {
            "enum": [
              "project_default",
              "username",
              "embed_visitor",
              "trigger_thread",
              "project_runtime"
            ],
            "type": "string",
            "description": "How this external user was created"
          },
          "isActive": {
            "type": "boolean",
            "description": "Whether this external user can act on the project (API / channels)",
            "default": true
          },
          "channel": {
            "type": [
              "string",
              "null"
            ],
            "description": "Messaging channel key from metadata (e.g. telegram)"
          },
          "profileSummary": {
            "type": [
              "string",
              "null"
            ],
            "description": "Short profile summary from metadata.profile"
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Profile photo URL from metadata.profile (`https` or `file:<uuid>`)"
          },
          "creditsUsed": {
            "type": "number",
            "description": "Sum of credit_usage_log.creditAmount for this eUID (forward-attributed only)",
            "default": 0
          },
          "createdAt": {
            "type": "string",
            "description": "When this external user was created (membership date)"
          },
          "lastSeenAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last activity: max of lastSeenAt, channel metadata.updatedAt, and last credit usage"
          },
          "isOnline": {
            "type": "boolean",
            "description": "True when lastSeenAt is within the last 5 minutes",
            "default": false
          },
          "resourceStats": {
            "type": "object",
            "properties": {
              "agentCount": {
                "type": "number",
                "description": "Number of agent workflows owned by this eUID",
                "default": 0
              },
              "workflowCount": {
                "type": "number",
                "description": "Number of static workflows owned by this eUID",
                "default": 0
              },
              "knowledgeStorageKb": {
                "type": "number",
                "description": "Estimated knowledge (vector) storage used in KiB for this eUID",
                "default": 0
              },
              "databaseStorageKb": {
                "type": "number",
                "description": "Estimated database storage used in KiB for this eUID",
                "default": 0
              },
              "storageUsedKb": {
                "type": "number",
                "description": "Total file storage used in KiB",
                "default": 0
              },
              "connectionCount": {
                "type": "number",
                "description": "Number of connected accounts for this eUID",
                "default": 0
              }
            },
            "required": [
              "agentCount",
              "workflowCount",
              "knowledgeStorageKb",
              "databaseStorageKb",
              "storageUsedKb",
              "connectionCount"
            ]
          },
          "addedByWorkflowIds": {
            "description": "Workflow/agent ids linked to this end-user (from external_user_workflow_links).",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "addedByWorkflowId": {
            "type": [
              "string",
              "null"
            ],
            "description": "First linked workflow/agent id (addedByWorkflowIds[0]).",
            "deprecated": true
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "description": "Channel profile / trigger context (e.g. Telegram username). Present for messaging-channel users."
          },
          "verifiedEmail": {
            "type": [
              "string",
              "null"
            ],
            "description": "Verified email claim from external_user_identities, if any."
          },
          "verifiedPhone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Verified phone claim (E.164) from external_user_identities, if any."
          },
          "identitySources": {
            "description": "Verified identity kinds attached to this eUID.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "name",
          "projectId",
          "source",
          "isActive"
        ]
      }
    },
    "total": {
      "type": "number",
      "description": "Total number of items across all pages"
    },
    "totalTools": {
      "type": "number",
      "description": "Optional secondary total (e.g. nested tools across all matching toolkits)"
    },
    "page": {
      "type": "number",
      "description": "Current page number (1-based)"
    },
    "limit": {
      "type": "number",
      "description": "Number of items per page"
    },
    "totalPages": {
      "type": "number",
      "description": "Total number of pages"
    },
    "hasNextPage": {
      "type": "boolean",
      "description": "Whether there is a next page"
    },
    "hasPreviousPage": {
      "type": "boolean",
      "description": "Whether there is a previous page"
    }
  },
  "required": [
    "success",
    "message",
    "data",
    "total"
  ]
}