use super::*;

pub(super) const THREAD_LODASH_ROWS: &[NativeModSig] = &[
    // ========== perry/thread (parallelMap, parallelFilter, spawn) ==========
    // Runtime expects both args as NaN-boxed f64 values and returns the same
    // — no unboxing/reboxing needed on either side. Closure is a POINTER_TAG'd
    // ClosureHeader; the runtime reads `func_ptr` and calls it per element.
    NativeModSig {
        module: "perry/thread",
        has_receiver: false,
        method: "parallelMap",
        class_filter: None,
        runtime: "js_thread_parallel_map",
        args: &[NA_F64, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "perry/thread",
        has_receiver: false,
        method: "parallelFilter",
        class_filter: None,
        runtime: "js_thread_parallel_filter",
        args: &[NA_F64, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "perry/thread",
        has_receiver: false,
        method: "spawn",
        class_filter: None,
        runtime: "js_thread_spawn",
        args: &[NA_F64],
        ret: NR_F64,
    },
    // ========== lodash (named-import form: import { chunk } from 'lodash') ==========
    // Default-import form (import _ from 'lodash'; _.chunk(...)) needs has_receiver:true
    // but would pass the module object as first arg, breaking the C signature.
    // Named imports produce object:None HIR nodes and route here correctly.
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "chunk",
        class_filter: None,
        runtime: "js_lodash_chunk",
        args: &[NA_PTR, NA_F64],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "compact",
        class_filter: None,
        runtime: "js_lodash_compact",
        args: &[NA_PTR],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "drop",
        class_filter: None,
        runtime: "js_lodash_drop",
        args: &[NA_PTR, NA_F64],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "first",
        class_filter: None,
        runtime: "js_lodash_first",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "head",
        class_filter: None,
        runtime: "js_lodash_first",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "last",
        class_filter: None,
        runtime: "js_lodash_last",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "flatten",
        class_filter: None,
        runtime: "js_lodash_flatten",
        args: &[NA_PTR],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "uniq",
        class_filter: None,
        runtime: "js_lodash_uniq",
        args: &[NA_PTR],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "reverse",
        class_filter: None,
        runtime: "js_lodash_reverse",
        args: &[NA_PTR],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "take",
        class_filter: None,
        runtime: "js_lodash_take",
        args: &[NA_PTR, NA_F64],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "camelCase",
        class_filter: None,
        runtime: "js_lodash_camel_case",
        args: &[NA_STR],
        ret: NR_STR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "kebabCase",
        class_filter: None,
        runtime: "js_lodash_kebab_case",
        args: &[NA_STR],
        ret: NR_STR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "snakeCase",
        class_filter: None,
        runtime: "js_lodash_snake_case",
        args: &[NA_STR],
        ret: NR_STR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "clamp",
        class_filter: None,
        runtime: "js_lodash_clamp",
        args: &[NA_F64, NA_F64, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "range",
        class_filter: None,
        runtime: "js_lodash_range",
        args: &[NA_F64, NA_F64, NA_F64],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "times",
        class_filter: None,
        runtime: "js_lodash_times",
        args: &[NA_F64],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "size",
        class_filter: None,
        runtime: "js_lodash_size",
        args: &[NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "tail",
        class_filter: None,
        runtime: "js_lodash_tail",
        args: &[NA_PTR],
        ret: NR_PTR,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "sum",
        class_filter: None,
        runtime: "js_lodash_sum",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "mean",
        class_filter: None,
        runtime: "js_lodash_mean",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "sumBy",
        class_filter: None,
        runtime: "js_lodash_sum_by",
        args: &[NA_PTR, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "meanBy",
        class_filter: None,
        runtime: "js_lodash_mean_by",
        args: &[NA_PTR, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "max",
        class_filter: None,
        runtime: "js_lodash_max",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "min",
        class_filter: None,
        runtime: "js_lodash_min",
        args: &[NA_PTR],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "maxBy",
        class_filter: None,
        runtime: "js_lodash_max_by",
        args: &[NA_PTR, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "minBy",
        class_filter: None,
        runtime: "js_lodash_min_by",
        args: &[NA_PTR, NA_F64],
        ret: NR_F64,
    },
    NativeModSig {
        module: "lodash",
        has_receiver: false,
        method: "inRange",
        class_filter: None,
        runtime: "js_lodash_in_range",
        args: &[NA_F64, NA_F64, NA_F64],
        ret: NR_F64,
    },
];
