import { defineStore } from 'pinia'

export const useTabbarStore = defineStore('tabbar', {
	state: () => ({
		list: [
			{
				iconPath: "home",
				selectedIconPath: "home-fill",
				text: '首页',
				count: 0,
				isDot: false,
				customIcon: false,
				pagePath: '/pages/index/index'
			},
			{
				iconPath: "chat",
				selectedIconPath: "chat-fill",
				text: '消息',
				count: 0,
				isDot: false,
				customIcon: false,
				pagePath: '/pages/chat/chat'
			},
			{
				iconPath: "account",
				selectedIconPath: "account-fill",
				text: '我的',
				count: 0,
				isDot: false,
				customIcon: false,
				pagePath: '/pages/personalCenter/personalCenter'
			},
		],
		activeColor: "#0069f6",
		inactiveColor: '#606266',
		backgroundColor: '#f7f7f7'
	}),
	actions: {
		setMessageCount(count) {
			this.list[1].count = count
		},
		setMessageCountRead() {
			const count = this.list[1].count
			if (count > 0) {
				this.list[1].count = count - 1
			}
		},
		setActiveColor(color) {
			this.activeColor = color
		},
		setInactiveColor(color) {
			this.inactiveColor = color
		}
	}
})