import { createAsyncThunk } from "@reduxjs/toolkit";
import { RootState } from "@/redux/store";

export const getAnalogInputsChartDataThunk = createAsyncThunk(
  "analogInputsChart/fetchChartData",
  async (_, { getState }) => {
    const state = getState() as RootState;
    //const { zeitraum, vonDatum, bisDatum } = state.analogInputsChart;
    const selectedInput = state.selectedAnalogInput;

    if (!selectedInput) return [];

    /*   const res = await fetch(
      `/api/cpl/getAnalogInputsHistory?inputId=${selectedInput.id}&zeitraum=${zeitraum}&von=${vonDatum}&bis=${bisDatum}`
    );
    const data = await res.json();
    return data; */
  }
);
