<template>
	<div class="shop-pages">
		<div class="flex flex-wrap link-list">
			<div
				class="link-item border border-br px-5 py-[5px] rounded-[3px] cursor-pointer mr-[10px] mb-[10px]"
				v-for="(item, index) in linkList"
				:class="{
					'border-primary text-primary': modelValue.path == item.path && modelValue.name == item.name,
				}"
				:key="index"
				@click="handleSelect(item)"
			>
				{{ item.name }}
			</div>
		</div>
	</div>
</template>

<script lang="ts" setup>
import type { PropType } from 'vue';
import { LinkTypeEnum, type Link } from '.';

defineProps({
	modelValue: {
		type: Object as PropType<Link>,
		default: () => ({}),
	},
});
const emit = defineEmits<{
	(event: 'update:modelValue', value: Link): void;
}>();

const linkList = ref([
	{
		path: '/pages/index/index',
		name: '首页',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/index',
		name: '工作台',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/contacts/index',
		name: '通讯录',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/index',
		name: '个人中心',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/index/news',
		name: '资讯中心',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/index/news-detail',
		name: '资讯详情',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/favorites',
		name: '我的收藏',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/service',
		name: '联系客服',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/settings',
		name: '个人资料',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/about',
		name: '关于',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/bind-phone',
		name: '绑定手机号',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/user/change-password',
		name: '修改密码',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/webview/index',
		name: '网页浏览',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/cache-monitor',
		name: '缓存监控',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/job-manage',
		name: '定时作业管理',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/logs-manage',
		name: '日志管理',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/notice-list',
		name: '通知公告',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/online-tokens',
		name: '在线用户',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/route-manage',
		name: '路由管理',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/scan-code',
		name: '扫一扫',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/schedule-manage',
		name: '日程',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/system-info',
		name: '系统信息',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/login/component/privacy-policy',
		name: '隐私协议',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/login/component/service-agreement',
		name: '服务协议',
		type: LinkTypeEnum.SHOP_PAGES,
	},
	{
		path: '/pages/home/biz/user/user-manage',
		name: '用户管理',
		type: LinkTypeEnum.SHOP_PAGES,
	}
]);

const handleSelect = (value: Link) => {
	emit('update:modelValue', value);
};
</script>
