/*
 * File: caseReviewSlice.ts
 * Description: Redux slice for CaseReview state management
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */

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

// Sample case type
export interface ReviewCase {
  id: string;
  patientName: string;
  images: string[];
  aiFindings: string;
}

// CaseReview state type
interface CaseReviewState {
  selectedCase: ReviewCase | null;
  loading: boolean;
  error: string | null;
}

const initialState: CaseReviewState = {
  selectedCase: null,
  loading: false,
  error: null,
};

/**
 * CaseReview slice for managing selected case and review state
 */
const caseReviewSlice = createSlice({
  name: 'caseReview',
  initialState,
  reducers: {
    selectCase(state, action: PayloadAction<ReviewCase>) {
      state.selectedCase = action.payload;
    },
    clearCase(state) {
      state.selectedCase = null;
    },
    setLoading(state, action: PayloadAction<boolean>) {
      state.loading = action.payload;
    },
    setError(state, action: PayloadAction<string | null>) {
      state.error = action.payload;
    },
  },
});

export const {
  selectCase,
  clearCase,
  setLoading,
  setError,
} = caseReviewSlice.actions;

export default caseReviewSlice.reducer;

/*
 * End of File: caseReviewSlice.ts
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */ 