import { defineStore } from "pinia";

export const useLogicStore = defineStore('store-list-logic', () => {
    const placesList = ref([])

    const searchLoading = ref(false)

    const setPlacesList = (list: any) => {
        if (Array.isArray(list)) {
            placesList.value = list
        } else {
            console.error('setPlacesList: Expected an array, but received:', list);
        }
    }

    function clearPlacesList() {
        placesList.value = []
    }

    return {
        placesList,
        searchLoading,
        setPlacesList,
        clearPlacesList,
    }
})
