import { heaviness, taste } from "@/types";
import { defineStore } from "pinia";

export const useHookahStore = defineStore("hookah", {
    state: (): {
        selectedTableNumber: number;
        selectedHeaviness?: heaviness;
        heavinessList: heaviness[];
        selectedTastes: taste[];
        tastesList: taste[];
    } => ({
        selectedTableNumber: -1,
        selectedHeaviness: undefined,
        selectedTastes: [],
        heavinessList: [
            { id: 0, title: "Лёгкий" },
            { id: 1, title: "Средний" },
            { id: 2, title: "Тяжёлый" },
        ],
        tastesList: generateTastes(),
    }),
    getters: {},
    actions: {
        clearSelected() {
            this.selectedTableNumber = -1;
            this.selectedHeaviness = undefined;
            this.selectedTastes = [];
        },
    },
});

function generateTastes() {
    const list = [];
    for (let i = 0; i < 15; i++) {
        list.push({
            id: i,
            title: `вкус ${i + 1}`,
        });
    }
    return list;
}
