//! Translation implementations for match aggregate functions

use crate::utils::direct_function_translation;
use crate::TranslationRegistry;
use hamelin_lib::func::defs::{
    MatchAvg, MatchCountAny, MatchCountStar, MatchFirst, MatchLast, MatchMax, MatchMin, MatchSum,
};

/// Register all match function translations.
pub fn register(registry: &mut TranslationRegistry) {
    // first(expression) - pass through
    registry.register::<MatchFirst>(direct_function_translation);

    // last(expression) - pass through
    registry.register::<MatchLast>(direct_function_translation);

    // count() - pass through
    registry.register::<MatchCountStar>(direct_function_translation);

    // count(x) - pass through
    registry.register::<MatchCountAny>(direct_function_translation);

    // sum(x) - pass through
    registry.register::<MatchSum>(direct_function_translation);

    // avg(x) - pass through
    registry.register::<MatchAvg>(direct_function_translation);

    // min(x) - pass through
    registry.register::<MatchMin>(direct_function_translation);

    // max(x) - pass through
    registry.register::<MatchMax>(direct_function_translation);
}
