use pyo3::prelude::*;
use pyo3_polars::{PyDataFrame, PySeries};

/// Python wrapper for [`crate::utils::qdf`] module.
#[allow(deprecated)]
#[pymodule]
pub fn utils(_py: Python, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(get_bdates_series_default, m)?)?;
    Ok(())
}

#[pyfunction]
pub fn get_bdates_series_default(
    start_date: String,
    end_date: String,
    freq: Option<String>,
) -> PyResult<PySeries> {
    Ok(PySeries(
        crate::utils::dateutils::get_bdates_series_default(start_date, end_date, freq)
            .map_err(|e| PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("{}", e)))?,
    ))
}
