/**
 * Edit Fields (Set) Node - Version 3.3
 * Discriminator: mode=manual
 */


// Helper types for special n8n fields
/**
 * Assignment type determines how the value is interpreted.
 * - string: Direct string value or expression evaluating to string
 * - number: Direct number value or expression evaluating to number
 * - boolean: Direct boolean value or expression evaluating to boolean
 * - array: Expression that evaluates to an array, e.g. ={{ [1, 2, 3] }} or ={{ $json.items }}
 * - object: Expression that evaluates to a plain object (not an array — use the array type for arrays), e.g. ={{ { key: 'value' } }} or ={{ $json.data }}
 * - binary: Property name of binary data in the input item, or expression to access binary data from previous nodes, e.g. ={{ $('Node').item.binary.data }}
 */
type AssignmentType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'binary';
type AssignmentCollectionValue = { assignments: Array<{ id: string; name: string; value: unknown; type: AssignmentType }> };

/** Edit item fields one by one */
export type SetV33ManualParams = {
  mode: 'manual';
/**
 * Whether this item should be duplicated a set number of times
 * @default false
 */
    duplicateItem?: boolean | Expression<boolean>;
/**
 * How many times the item should be duplicated, mainly used for testing and debugging
 * @displayOptions.show { duplicateItem: [true] }
 * @default 0
 */
    duplicateCount?: number | Expression<number>;
/**
 * Fields to Set
 * @default {}
 */
    assignments?: AssignmentCollectionValue;
/**
 * Whether to pass to the output all the input fields (along with the fields set in 'Fields to Set')
 * @default false
 */
    includeOtherFields?: boolean | Expression<boolean>;
/**
 * How to select the fields you want to include in your output items
 * @displayOptions.hide { /includeOtherFields: [false] }
 * @default all
 */
    include?: 'all' | 'selected' | 'except' | Expression<string>;
/**
 * Comma-separated list of the field names you want to include in the output. You can drag the selected fields from the input panel.
 * @displayOptions.show { include: ["selected"], /includeOtherFields: [true] }
 */
    includeFields?: string | Expression<string> | PlaceholderValue;
/**
 * Comma-separated list of the field names you want to exclude from the output. You can drag the selected fields from the input panel.
 * @displayOptions.show { include: ["except"], /includeOtherFields: [true] }
 */
    excludeFields?: string | Expression<string> | PlaceholderValue;
  options?: {
    /** Whether binary data should be included if present in the input item
     * @default true
     */
    includeBinary?: boolean | Expression<boolean>;
    /** Whether binary data should be stripped from the input item. Only applies when "Include Other Input Fields" is enabled.
     * @displayOptions.show { /includeOtherFields: [true] }
     * @default true
     */
    stripBinary?: boolean | Expression<boolean>;
    /** Whether to ignore field type errors and apply a less strict type conversion
     * @default false
     */
    ignoreConversionErrors?: boolean | Expression<boolean>;
    /** By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }. If that is not intended this can be deactivated, it will then set { "a.b": value } instead.
     * @default true
     */
    dotNotation?: boolean | Expression<boolean>;
  };
};

export type SetV33ManualNode = {
  type: 'n8n-nodes-base.set';
  version: 3.3;
  config: NodeConfig<SetV33ManualParams>;
};