import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { ServiceCode } from "@/enums/ServiceCode";

interface TargetServiceState {
    serviceCode: ServiceCode;
}

const initialState: TargetServiceState = {
    serviceCode: ServiceCode.UNDEFINED,
};

export const targetServiceSlice = createSlice({
    name: "targetService",
    initialState,
    reducers: {
        setTargetService: (state, action: PayloadAction<ServiceCode>) => {
            state.serviceCode = action.payload;
        },
    },
});

export const { setTargetService } = targetServiceSlice.actions;

export default targetServiceSlice.reducer;
