// /redux/thunks/webservice/fetchGisSystemStaticThunk.js

import { createAsyncThunk } from "@reduxjs/toolkit";
import { fetchGisSystemStaticService } from "../../../services/webservice/fetchGisSystemStaticService";
import { setInitialLayers } from "../../slices/mapLayersSlice"; // Importiere die Action Creator

/**
 * Redux-Thunk für fetchGisSystemStatic
 */
export const fetchGisSystemStaticThunk = createAsyncThunk("gisSystemStatic/fetch", async (_, { dispatch }) => {
  const systems = await fetchGisSystemStaticService();
  dispatch(setInitialLayers(systems)); // ✅ jetzt funktioniert!
  return systems;
});
