import {
  getFileProcess,
  getFileProcessOther,
} from "../../../features/file/services/getFileProcess";
import { getSlaughterHousesRequest } from "../../../features/file/services/getSlaughterHousesRequest";
import { getAllocationInformation } from "../../../features/file/services/get-allocation-information";
import { provinceDoAllocation } from "../../../features/file/services/province-do-allocation";
import { getAcceptedSlaughterRequest } from "../../../features/file/services/getAcceptedSlaughterRequest";
import { getMonthlyPercent } from "../../../features/file/services/get-monthly-percent";
import { poultryRequestIndexWeightService } from "../../../features/file/services/city-edit-avculture.info";

export const fileExtraReducers = {
  [getFileProcess.fulfilled]: (state, { payload }) => {
    state.pending = false;
    state.file = payload.data;
  },
  [getFileProcess.pending]: (state) => {
    state.pending = true;
    // state.file = null;
  },
  [getFileProcessOther.fulfilled]: (state, { payload }) => {
    state.pending = false;
    state.file = payload.data;
  },
  [getFileProcessOther.pending]: (state) => {
    state.pending = true;
    // state.file = null;
  },
  [getAcceptedSlaughterRequest.fulfilled]: (state, { payload }) => {
    state.pending = false;
    state.acceptedSlaughterRequest = payload.data;
  },
  [getAcceptedSlaughterRequest.pending]: (state) => {
    state.pending = true;
  },
  [getSlaughterHousesRequest.fulfilled]: (state, { payload }) => {
    state.pending = false;
    state.slaughterHousesRequest = payload.data;
  },
  [getSlaughterHousesRequest.pending]: (state) => {
    state.pending = true;
  },
  [getAllocationInformation.fulfilled]: (state, { payload }) => {
    state.pending = false;
    state.allocationInformation = payload.data;
  },
  [getAllocationInformation.pending]: (state) => {
    state.pending = true;
  },
  [provinceDoAllocation.fulfilled]: (state, { payload }) => {
    state.pending = false;
  },
  [provinceDoAllocation.pending]: (state) => {
    state.pending = true;
  },
  [getMonthlyPercent.fulfilled]: (state, { payload }) => {
    state.pending = false;
    state.monthlyData = payload.data;
  },
  [poultryRequestIndexWeightService.fulfilled]: (state, { payload }) => {
    state.poultryRequestIndexWeight = payload.data;
  },
  [getMonthlyPercent.pending]: (state) => {
    state.pending = true;
  },
};
