import { createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import { getRoleFromUrl } from "../../../utils/getRoleFromUrl";

export const cityGetHatchingInfoFull = createAsyncThunk(
  "CITY_GET_HATCHING_INFO_FULL",
  async (d = {}) => {
    const { age1 = 0, age2 = 0 } = d;
    const { data, status } = await axios.get(
      `/hatching-for-dashboard/?type=total-dashboard&search=filter&value=${
        d?.textValue || ""
      }&role=${getRoleFromUrl()}&age1=${age1}&age2=${age2}${
        d?.unknown ? `&unknown=true` : ""
      }${d?.all ? `&all=true` : ""}${d?.tab ? `&tab=${d.tab}` : ""}&date1=${
        d?.date1 || ""
      }&date2=${d?.date2 || ""}`
    );
    return { data, status };
  }
);
