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

interface TargetServiceState {
    serviceCode: Scopes;
}

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

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

export const { setTargetService } = targetServiceSlice.actions;

export default targetServiceSlice.reducer;
