import pandas as pd

from pydpeet.io.utils.formatter_utils import round_testtime, typecast


def get_data_into_format(df: pd.DataFrame) -> pd.DataFrame:
    """
    Format the given DataFrame into a standard format.

    This function takes a DataFrame and applies some formatting to it. It rounds the
    "Test_Time[s]" column to 5 decimal places, and typecasts the "Step_Count", "Voltage[V]",
    "Current[A]", "Test_Time[s]", "EIS_f[Hz]", "EIS_Z_Real[Ohm]" and "EIS_Z_Imag[Ohm]" columns to
    int, float, float, float, float, float and float respectively.

    Parameters
    ----------
    data_frame : pandas.DataFrame
        DataFrame to be formatted

    Returns
    -------
    pandas.DataFrame
        Formatted DataFrame
    """
    df = round_testtime(df)
    typecast(df, "Step_Count", int)
    typecast(df, "Voltage[V]", float)
    typecast(df, "Current[A]", float)
    typecast(df, "Test_Time[s]", float)
    typecast(df, "EIS_f[Hz]", float)
    typecast(df, "EIS_Z_Real[Ohm]", float)
    typecast(df, "EIS_Z_Imag[Ohm]", float)

    return df
