use super::super::{FunctionMeta, Registry};

pub mod averagea;
pub mod averageifs;
pub mod count;
pub mod countblank;
pub mod geomean;
pub mod harmean;
pub mod kurt;
pub mod large;
pub mod max;
pub mod maxa;
pub mod maxifs;
pub mod median;
pub mod min;
pub mod mina;
pub mod minifs;
pub mod mode;
pub mod mode_mult;
pub mod mode_sngl;
pub mod percentile;
pub mod percentile_exc;
pub mod percentile_inc;
pub mod percentrank;
pub mod percentrank_exc;
pub mod percentrank_inc;
pub mod quartile;
pub mod quartile_exc;
pub mod quartile_inc;
pub mod rank;
pub mod rank_avg;
pub mod rank_eq;
pub mod skew;
pub mod skew_p;
pub mod small;
pub mod stat_helpers;
pub mod trimmean;

pub mod avedev;
pub mod covariance_p;
pub mod covariance_s;
pub mod devsq;
pub mod stdev;
pub mod stdev_p;
pub mod stdev_s;
pub mod stdeva;
pub mod stdevp;
pub mod stdevpa;
pub mod var;
pub mod var_p;
pub mod var_s;
pub mod vara;
pub mod varp;
pub mod varpa;

pub fn register_statistical(registry: &mut Registry) {
    registry.register_eager("AVERAGEA",  averagea::averagea_fn,   FunctionMeta { category: "statistical", signature: "AVERAGEA(value1,...)",                          description: "Average including booleans and text" });
    registry.register_eager("AVERAGEIFS",averageifs::averageifs_fn,FunctionMeta { category: "statistical", signature: "AVERAGEIFS(avg_range,criteria_range1,criteria1,...)", description: "Conditional average with multiple criteria" });
    registry.register_lazy("COUNT",  count::count_lazy_fn,  FunctionMeta { category: "statistical", signature: "COUNT(value1,...)",  description: "Count numeric values" });
    registry.register_lazy("COUNTA", count::counta_lazy_fn, FunctionMeta { category: "statistical", signature: "COUNTA(value1,...)", description: "Count non-empty values" });
    registry.register_eager("COUNTBLANK", countblank::countblank_fn, FunctionMeta { category: "statistical", signature: "COUNTBLANK(range)", description: "Count blank/empty cells" });
    registry.register_eager("GEOMEAN",  geomean::geomean_fn,  FunctionMeta { category: "statistical", signature: "GEOMEAN(value1,...)", description: "Geometric mean" });
    registry.register_eager("HARMEAN",  harmean::harmean_fn,  FunctionMeta { category: "statistical", signature: "HARMEAN(value1,...)", description: "Harmonic mean" });
    registry.register_eager("KURT",     kurt::kurt_fn,        FunctionMeta { category: "statistical", signature: "KURT(value1,...)",    description: "Excess kurtosis" });
    registry.register_eager("LARGE",  large::large_fn,  FunctionMeta { category: "statistical", signature: "LARGE(array,k)",   description: "k-th largest value" });
    registry.register_eager("MAX",   max::max_fn,           FunctionMeta { category: "statistical", signature: "MAX(value1,...)",    description: "Maximum value" });
    registry.register_eager("MAXA",  maxa::maxa_fn,         FunctionMeta { category: "statistical", signature: "MAXA(value1,...)",   description: "Maximum including booleans and text" });
    registry.register_eager("MAXIFS",maxifs::maxifs_fn,     FunctionMeta { category: "statistical", signature: "MAXIFS(max_range,criteria_range1,criteria1,...)", description: "Maximum with multiple criteria" });
    registry.register_eager("MEDIAN",median::median_fn,     FunctionMeta { category: "statistical", signature: "MEDIAN(value1,...)", description: "Median value" });
    registry.register_eager("MIN",   min::min_fn,           FunctionMeta { category: "statistical", signature: "MIN(value1,...)",    description: "Minimum value" });
    registry.register_eager("MINA",  mina::mina_fn,         FunctionMeta { category: "statistical", signature: "MINA(value1,...)",   description: "Minimum including booleans and text" });
    registry.register_eager("MINIFS",minifs::minifs_fn,     FunctionMeta { category: "statistical", signature: "MINIFS(min_range,criteria_range1,criteria1,...)", description: "Minimum with multiple criteria" });
    registry.register_eager("MODE",      mode::mode_fn,           FunctionMeta { category: "statistical", signature: "MODE(value1,...)",      description: "Most frequent value" });
    registry.register_eager("MODE.MULT", mode_mult::mode_mult_fn, FunctionMeta { category: "statistical", signature: "MODE.MULT(value1,...)", description: "All most frequent values" });
    registry.register_eager("MODE.SNGL", mode_sngl::mode_sngl_fn, FunctionMeta { category: "statistical", signature: "MODE.SNGL(value1,...)", description: "Most frequent value" });
    registry.register_eager("PERCENTILE",     percentile::percentile_fn,         FunctionMeta { category: "statistical", signature: "PERCENTILE(array,k)",     description: "k-th percentile (inclusive)" });
    registry.register_eager("PERCENTILE.EXC", percentile_exc::percentile_exc_fn, FunctionMeta { category: "statistical", signature: "PERCENTILE.EXC(array,k)", description: "Exclusive percentile" });
    registry.register_eager("PERCENTILE.INC", percentile_inc::percentile_inc_fn, FunctionMeta { category: "statistical", signature: "PERCENTILE.INC(array,k)", description: "Inclusive percentile" });
    registry.register_eager("PERCENTRANK",     percentrank::percentrank_fn,         FunctionMeta { category: "statistical", signature: "PERCENTRANK(array,x,[sig])",     description: "Percentile rank (inclusive)" });
    registry.register_eager("PERCENTRANK.EXC", percentrank_exc::percentrank_exc_fn, FunctionMeta { category: "statistical", signature: "PERCENTRANK.EXC(array,x,[sig])", description: "Exclusive percentile rank" });
    registry.register_eager("PERCENTRANK.INC", percentrank_inc::percentrank_inc_fn, FunctionMeta { category: "statistical", signature: "PERCENTRANK.INC(array,x,[sig])", description: "Inclusive percentile rank" });
    registry.register_eager("QUARTILE",     quartile::quartile_fn,         FunctionMeta { category: "statistical", signature: "QUARTILE(array,quart)",     description: "Quartile (inclusive)" });
    registry.register_eager("QUARTILE.EXC", quartile_exc::quartile_exc_fn, FunctionMeta { category: "statistical", signature: "QUARTILE.EXC(array,quart)", description: "Exclusive quartile" });
    registry.register_eager("QUARTILE.INC", quartile_inc::quartile_inc_fn, FunctionMeta { category: "statistical", signature: "QUARTILE.INC(array,quart)", description: "Inclusive quartile" });
    registry.register_eager("RANK",     rank::rank_fn,         FunctionMeta { category: "statistical", signature: "RANK(number,ref,[order])",     description: "Rank of number (ties=lowest)" });
    registry.register_eager("RANK.AVG", rank_avg::rank_avg_fn, FunctionMeta { category: "statistical", signature: "RANK.AVG(number,ref,[order])", description: "Rank with average for ties" });
    registry.register_eager("RANK.EQ",  rank_eq::rank_eq_fn,   FunctionMeta { category: "statistical", signature: "RANK.EQ(number,ref,[order])",  description: "Rank with equal (lowest) for ties" });
    registry.register_eager("SKEW",   skew::skew_fn,        FunctionMeta { category: "statistical", signature: "SKEW(value1,...)",   description: "Sample skewness" });
    registry.register_eager("SKEW.P", skew_p::skew_p_fn,   FunctionMeta { category: "statistical", signature: "SKEW.P(value1,...)", description: "Population skewness" });
    registry.register_eager("SMALL",  small::small_fn,  FunctionMeta { category: "statistical", signature: "SMALL(array,k)",   description: "k-th smallest value" });
    registry.register_eager("TRIMMEAN", trimmean::trimmean_fn, FunctionMeta { category: "statistical", signature: "TRIMMEAN(data,percent)", description: "Trimmed mean" });

    registry.register_eager("AVEDEV",      avedev::avedev_fn,           FunctionMeta { category: "statistical", signature: "AVEDEV(value1,...)",       description: "Average of absolute deviations from the mean" });
    registry.register_eager("DEVSQ",       devsq::devsq_fn,             FunctionMeta { category: "statistical", signature: "DEVSQ(value1,...)",        description: "Sum of squared deviations from the mean" });
    registry.register_eager("COVARIANCE.P",covariance_p::covariance_p_fn, FunctionMeta { category: "statistical", signature: "COVARIANCE.P(array1,array2)", description: "Population covariance" });
    registry.register_eager("COVARIANCE.S",covariance_s::covariance_s_fn, FunctionMeta { category: "statistical", signature: "COVARIANCE.S(array1,array2)", description: "Sample covariance" });
    registry.register_eager("STDEV",       stdev::stdev_fn,             FunctionMeta { category: "statistical", signature: "STDEV(value1,...)",         description: "Sample standard deviation" });
    registry.register_eager("STDEV.P",     stdev_p::stdev_p_fn,         FunctionMeta { category: "statistical", signature: "STDEV.P(value1,...)",       description: "Population standard deviation" });
    registry.register_eager("STDEV.S",     stdev_s::stdev_s_fn,         FunctionMeta { category: "statistical", signature: "STDEV.S(value1,...)",       description: "Sample standard deviation" });
    registry.register_eager("STDEVA",      stdeva::stdeva_fn,           FunctionMeta { category: "statistical", signature: "STDEVA(value1,...)",        description: "Sample standard deviation including text and logical values" });
    registry.register_eager("STDEVP",      stdevp::stdevp_fn,           FunctionMeta { category: "statistical", signature: "STDEVP(value1,...)",        description: "Population standard deviation" });
    registry.register_eager("STDEVPA",     stdevpa::stdevpa_fn,         FunctionMeta { category: "statistical", signature: "STDEVPA(value1,...)",       description: "Population standard deviation including text and logical values" });
    registry.register_eager("VAR",         var::var_fn,                 FunctionMeta { category: "statistical", signature: "VAR(value1,...)",           description: "Sample variance" });
    registry.register_eager("VAR.P",       var_p::var_p_fn,             FunctionMeta { category: "statistical", signature: "VAR.P(value1,...)",         description: "Population variance" });
    registry.register_eager("VAR.S",       var_s::var_s_fn,             FunctionMeta { category: "statistical", signature: "VAR.S(value1,...)",         description: "Sample variance" });
    registry.register_eager("VARA",        vara::vara_fn,               FunctionMeta { category: "statistical", signature: "VARA(value1,...)",          description: "Sample variance including text and logical values" });
    registry.register_eager("VARP",        varp::varp_fn,               FunctionMeta { category: "statistical", signature: "VARP(value1,...)",          description: "Population variance" });
    registry.register_eager("VARPA",       varpa::varpa_fn,             FunctionMeta { category: "statistical", signature: "VARPA(value1,...)",         description: "Population variance including text and logical values" });
}
