use pyo3::prelude::*;
use pyo3_polars::PyDataFrame;

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

/// Python wrapper for downloading JPMAQS indicators as a DataFrame.
/// See [`crate::download::jpmaqsdownload::download_jpmaqs_indicators_as_df`] for full documentation.
/// Arguments:
/// - `client_id`: The client ID.
/// - `client_secret`: The client secret.
/// - `tickers`: The tickers.
/// - `start_date`: The start date.
/// - `end_date`: The end date.
/// 
/// Returns:
/// - A standardized Quantamental DataFrame.
#[pyfunction]
pub fn download_jpmaqs_indicators_as_df(
    client_id: String,
    client_secret: String,
    tickers: Vec<String>,
    metrics: Option<Vec<String>>,
    start_date: Option<String>,
    end_date: Option<String>,
) -> PyResult<PyDataFrame> {
    Ok(PyDataFrame(
        crate::download::jpmaqsdownload::download_jpmaqs_indicators_as_df(
            client_id,
            client_secret,
            tickers,
            metrics,
            start_date,
            end_date,
        )
        .unwrap(),
    ))
}
