import { create } from 'zustand'

type SurveySaleTabState = {
  basicInfoSelected: boolean
  roofInfoSelected: boolean
  setBasicInfoSelected: () => void
  setRoofInfoSelected: () => void
  reset: () => void
}

type InitialState = {
  basicInfoSelected: boolean
  roofInfoSelected: boolean
}

const initialState: InitialState = {
  basicInfoSelected: true,
  roofInfoSelected: false,
}

export const useSurveySaleTabState = create<SurveySaleTabState>((set) => ({
  ...initialState,
  setBasicInfoSelected: () => set((state) => ({ ...state, basicInfoSelected: true, roofInfoSelected: false })),
  setRoofInfoSelected: () => set((state) => ({ ...state, basicInfoSelected: false, roofInfoSelected: true })),
  reset: () => set(initialState),
}))
