/**
 * Chat Trigger Node - Version 1.1
 * Runs the workflow when an n8n generated webchat is submitted
 */


export interface LcChatTriggerV11Params {
/**
 * Whether the chat should be publicly available or only accessible through the manual chat interface
 * @default false
 */
    public?: boolean | Expression<boolean>;
/**
 * Mode
 * @displayOptions.show { public: [true] }
 * @default hostedChat
 */
    mode?: 'hostedChat' | 'webhook' | Expression<string>;
/**
 * The way to authenticate
 * @builderHint Default to 'none'. n8n exposes inbound trigger URLs publicly by design. Only select an authentication method when the user explicitly asks to authenticate inbound traffic.
 * @displayOptions.show { public: [true] }
 * @default none
 */
    authentication?: 'basicAuth' | 'n8nUserAuth' | 'none' | Expression<string>;
/**
 * Default messages shown at the start of the chat, one per line
 * @displayOptions.show { mode: ["hostedChat"], public: [true] }
 */
    initialMessages?: string | Expression<string>;
/**
 * Whether to make the agent available in n8n Chat Hub for n8n instance users to chat with
 * @default false
 */
    availableInChat?: boolean;
/**
 * Options
 * @displayOptions.show { public: [false, true], mode: ["hostedChat", "webhook"] }
 * @default {}
 */
    options?: {
    /** Whether to allow file uploads in the chat
     * @default false
     */
    allowFileUploads?: boolean | Expression<boolean>;
    /** Allowed file types for upload. Comma-separated list of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types" target="_blank"&gt;MIME types&lt;/a&gt;.
     * @default *
     */
    allowedFilesMimeTypes?: string | Expression<string>;
    /** Comma-separated list of URLs allowed for cross-origin non-preflight requests. Use * (default) to allow all origins.
     * @displayOptions.show { /mode: ["hostedChat", "webhook"] }
     * @default *
     */
    allowedOrigins?: string | Expression<string>;
    /** Shown as placeholder text in the chat input field
     * @displayOptions.show { /mode: ["hostedChat"] }
     * @default Type your question..
     */
    inputPlaceholder?: string | Expression<string>;
    /** If loading messages of a previous session should be enabled
     * @builderHint This ONLY rehydrates the chat widget UI when the user reopens it — it does NOT give the Agent memory. The Agent gets memory from its own memory subnode regardless of this setting. Only set to 'memory' if the user wants the widget to restore visible history on reload; if so, you MUST also attach a memory subnode to this trigger (use the same memory node as the Agent so widget history matches what the Agent remembers). Otherwise leave as 'notSupported'.
     * @default notSupported
     */
    loadPreviousSession?: 'notSupported' | 'memory' | 'manually' | Expression<string>;
    /** Whether to show the welcome screen at the start of the chat
     * @displayOptions.show { /mode: ["hostedChat"] }
     * @default false
     */
    showWelcomeScreen?: boolean | Expression<boolean>;
    /** Shown as part of the welcome screen, in the middle of the chat window
     * @displayOptions.show { showWelcomeScreen: [true], /mode: ["hostedChat"] }
     * @default New Conversation
     */
    getStarted?: string | Expression<string>;
    /** Shown at the top of the chat, under the title
     * @displayOptions.show { /mode: ["hostedChat"] }
     * @default Start a chat. We're here to help you 24/7.
     */
    subtitle?: string | Expression<string>;
    /** Shown at the top of the chat
     * @displayOptions.show { /mode: ["hostedChat"] }
     * @default Hi there! 👋
     */
    title?: string | Expression<string>;
    /** Override default styling of the public chat interface with CSS
     * @displayOptions.show { /mode: ["hostedChat"] }
     */
    customCss?: string | Expression<string>;
    /** When and how to respond to the webhook
     * @builderHint 'streaming' (preferred for Agent-backed chats): the connected Agent streams its reply to the widget directly — no extra wiring. Place logging or side-effects on a PARALLEL branch off the trigger or Agent, never inline after the Agent. 'lastNode': the last-executed node's output is sent to the widget — that node MUST emit `{ output: '&lt;reply text&gt;' }` (typically the Agent itself, or a Set node re-shaping data). NEVER terminate the chain with a Data Table insert, HTTP Request, or other side-effect node — their output is not a chat reply and the widget will error. 'responseNodes' / 'responseNode': requires explicit response nodes inside the flow (`@n8n/n8n-nodes-langchain.chat` for chat-hub mode, `n8n-nodes-base.respondToWebhook` for webhook mode).
     * @default lastNode
     */
    responseMode?: 'lastNode' | 'responseNode' | Expression<string>;
    /** Whether to automatically save &lt;a href="https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executiondata/" target="_blank"&gt;highlighted data&lt;/a&gt;. This data can then be used to filter executions in the Executions view. Available on Pro and Enterprise plans in n8n Cloud, and on Enterprise or registered Community Edition for self-hosted. Defaults to true.
     * @default true
     */
    autoSaveHighlightedData?: boolean | Expression<boolean>;
  };
}

export interface LcChatTriggerV11SubnodeConfig {
  /**
   * @displayOptions.show { options.loadPreviousSession: ["memory"] }
   */
  memory: MemoryInstance;
}

export interface LcChatTriggerV11Credentials {
  httpBasicAuth: CredentialReference;
}

interface LcChatTriggerV11NodeBase {
  type: '@n8n/n8n-nodes-langchain.chatTrigger';
  version: 1.1;
  credentials?: LcChatTriggerV11Credentials;
  isTrigger: true;
}

export type LcChatTriggerV11ParamsNode = LcChatTriggerV11NodeBase & {
  config: NodeConfig<LcChatTriggerV11Params> & { subnodes: LcChatTriggerV11SubnodeConfig };
};

export type LcChatTriggerV11Node = LcChatTriggerV11ParamsNode;