/**
 * Merge Node - Version 2.1
 * Discriminator: mode=combine
 */


/** Merge matching items together */
export type MergeV21CombineParams = {
  mode: 'combine';
/**
 * Combination Mode
 * @default mergeByFields
 */
    combinationMode?: 'mergeByFields' | 'mergeByPosition' | 'multiplex' | Expression<string>;
/**
 * Fields to Match
 * @displayOptions.show { combinationMode: ["mergeByFields"] }
 * @default {"values":[{"field1":"","field2":""}]}
 */
    mergeByFields?: {
        /** Values
     */
    values?: Array<{
      /** Input 1 Field
       * @hint  Enter the field name as text
       */
      field1?: string | Expression<string> | PlaceholderValue;
      /** Input 2 Field
       * @hint  Enter the field name as text
       */
      field2?: string | Expression<string> | PlaceholderValue;
    }>;
  };
/**
 * Output Type
 * @displayOptions.show { combinationMode: ["mergeByFields"] }
 * @default keepMatches
 */
    joinMode?: 'keepMatches' | 'keepNonMatches' | 'keepEverything' | 'enrichInput1' | 'enrichInput2' | Expression<string>;
/**
 * Output Data From
 * @displayOptions.show { combinationMode: ["mergeByFields"], joinMode: ["keepMatches", "keepNonMatches"] }
 * @default both
 */
    outputDataFrom?: 'both' | 'input1' | 'input2' | Expression<string>;
/**
 * Options
 * @displayOptions.hide { mode: ["chooseBranch", "append"] }
 * @default {}
 */
    options?: {
    /** Clash Handling
     * @displayOptions.show { /combinationMode: ["mergeByFields"] }
     * @displayOptions.hide { /joinMode: ["keepMatches", "keepNonMatches"] }
     * @default {"values":{"resolveClash":"preferInput2","mergeMode":"deepMerge","overrideEmpty":false}}
     */
    clashHandling?: {
        /** Values
     */
    values?: {
      /** When Field Values Clash
       */
      resolveClash?: 'addSuffix' | 'preferInput1' | 'preferInput2' | Expression<string>;
      /** Merging Nested Fields
       * @hint How to merge when there are sub-fields below the top-level ones
       * @displayOptions.show { resolveClash: ["preferInput1", "preferInput2"] }
       * @default deepMerge
       */
      mergeMode?: 'deepMerge' | 'shallowMerge' | Expression<string>;
      /** Whether to override the preferred input version for a field if it is empty and the other version isn't. Here 'empty' means undefined, null or an empty string.
       * @displayOptions.show { resolveClash: ["preferInput1", "preferInput2"] }
       * @default false
       */
      overrideEmpty?: boolean | Expression<boolean>;
    };
  };
    /** Clash Handling
     * @displayOptions.show { /combinationMode: ["mergeByFields"], /joinMode: ["keepMatches"], /outputDataFrom: ["both"] }
     * @default {"values":{"resolveClash":"preferInput2","mergeMode":"deepMerge","overrideEmpty":false}}
     */
    clashHandling?: {
        /** Values
     */
    values?: {
      /** When Field Values Clash
       */
      resolveClash?: 'addSuffix' | 'preferInput1' | 'preferInput2' | Expression<string>;
      /** Merging Nested Fields
       * @hint How to merge when there are sub-fields below the top-level ones
       * @displayOptions.show { resolveClash: ["preferInput1", "preferInput2"] }
       * @default deepMerge
       */
      mergeMode?: 'deepMerge' | 'shallowMerge' | Expression<string>;
      /** Whether to override the preferred input version for a field if it is empty and the other version isn't. Here 'empty' means undefined, null or an empty string.
       * @displayOptions.show { resolveClash: ["preferInput1", "preferInput2"] }
       * @default false
       */
      overrideEmpty?: boolean | Expression<boolean>;
    };
  };
    /** Clash Handling
     * @displayOptions.show { /combinationMode: ["multiplex", "mergeByPosition"] }
     * @default {"values":{"resolveClash":"preferInput2","mergeMode":"deepMerge","overrideEmpty":false}}
     */
    clashHandling?: {
        /** Values
     */
    values?: {
      /** When Field Values Clash
       */
      resolveClash?: 'addSuffix' | 'preferInput1' | 'preferInput2' | Expression<string>;
      /** Merging Nested Fields
       * @hint How to merge when there are sub-fields below the top-level ones
       * @displayOptions.show { resolveClash: ["preferInput1", "preferInput2"] }
       * @default deepMerge
       */
      mergeMode?: 'deepMerge' | 'shallowMerge' | Expression<string>;
      /** Whether to override the preferred input version for a field if it is empty and the other version isn't. Here 'empty' means undefined, null or an empty string.
       * @displayOptions.show { resolveClash: ["preferInput1", "preferInput2"] }
       * @default false
       */
      overrideEmpty?: boolean | Expression<boolean>;
    };
  };
    /** Whether to disallow referencing child fields using `parent.child` in the field name
     * @displayOptions.show { /combinationMode: ["mergeByFields"] }
     * @default false
     */
    disableDotNotation?: boolean | Expression<boolean>;
    /** Whether to tolerate small type differences when comparing fields. E.g. the number 3 and the string '3' are treated as the same.
     * @default false
     */
    fuzzyCompare?: boolean | Expression<boolean>;
    /** If there are different numbers of items in input 1 and input 2, whether to include the ones at the end with nothing to pair with
     * @displayOptions.show { /combinationMode: ["mergeByPosition"] }
     * @default false
     */
    includeUnpaired?: boolean | Expression<boolean>;
    /** Multiple Matches
     * @displayOptions.show { /combinationMode: ["mergeByFields"], /joinMode: ["keepMatches"], /outputDataFrom: ["both"] }
     * @default all
     */
    multipleMatches?: 'all' | 'first' | Expression<string>;
    /** Multiple Matches
     * @displayOptions.show { /combinationMode: ["mergeByFields"], /joinMode: ["enrichInput1", "enrichInput2", "keepEverything"] }
     * @default all
     */
    multipleMatches?: 'all' | 'first' | Expression<string>;
  };
};

export type MergeV21CombineNode = {
  type: 'n8n-nodes-base.merge';
  version: 2.1;
  config: NodeConfig<MergeV21CombineParams>;
};