mod smoothmethod;
mod spectraltools;
mod sharpmethod;


#[tauri::command]
pub fn interpolate_spline(x: Vec<f64>, y: Vec<f64>, step: f64) ->Vec<(f64, f64)>{
    spectraltools::interpolate_spline(x, y, step).unwrap()
}

#[tauri::command]
pub fn interpolate_spline_at_points(x: Vec<f64>, y: Vec<f64>, x_target: Vec<f64>) -> Vec<f64>{
    spectraltools::interpolate_spline_at_points(x, y, x_target).unwrap()
}

#[tauri::command]
pub fn sg_smooth(data: Vec<f64>, window: usize, order: usize) -> Vec<f64> {
    smoothmethod::savgol(data, window, order)
}
#[tauri::command]
pub fn gaussian_filter_high(data: Vec<f64>, sigma: f64) -> Vec<f64> {
    sharpmethod::high_pass_gaussian_filter(data, sigma)
}

#[tauri::command]
pub fn find_peek(data: Vec<f64>, minheigh: f64) -> Vec<(u32, f64)> {
    spectraltools::find_peek(data, minheigh)
}

#[tauri::command]
pub fn compute_weave_coeff(x: Vec<f64>, y: Vec<f64>) -> Vec<f64> {
    spectraltools::compute_weave_coeff(x, y)
}


pub fn polynomial_smooth_u32(y: &[u32], degree: usize) -> Vec<u32> {
    smoothmethod::polynomial_smooth_u32(y, degree)
}

pub fn polynomial_smooth_u16(y: Vec<u16>, degree: usize) -> Vec<u16> {
  
    smoothmethod::polynomial_smooth_u16(&y, degree)
}