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

export interface ImageZoomModalState {
    isVisible: boolean;
    imageUrls: string[]
}

const initialState: ImageZoomModalState = {
    isVisible: false,
    imageUrls: []
}

export const imageZoomModalSlice = createSlice({
    name: 'loadingModal',
    initialState,
    reducers: {
        openImageZoomModal: (state) => {
            state.isVisible = true
        },
        closeImageZoomModal: (state) => {
            state.isVisible = false
        },
        setImages: (state, action: PayloadAction<string[]>) => {
            state.imageUrls = action.payload;
        }
    }
})

export const {closeImageZoomModal, openImageZoomModal, setImages} = imageZoomModalSlice.actions;
export default imageZoomModalSlice.reducer;