import { defineStore } from 'pinia';
import { ref } from 'vue';

export const usePagesStore = defineStore(
    'pagesStore',
    () => {
        const mapPages = ref<Map<string, any>>(new Map([
            // 主包 pages
            ['pages/index/index', { title: '首页' }],
            ['pages/login/login', { title: '用户登录' }],
            ['pages/plant/base/index', { title: '基地' }],
            ['pages/plant/port/index', { title: '种养殖' }],
            ['pages/production/index', { title: '生产端' }],
            // 基地分包 plant/base
            ['plant/base/base-list/index', { title: '基地列表' }],
            ['plant/base/base-detail/index', { title: '基地详情' }],
            ['plant/base/base-edit/index', { title: '添加基地' }],
            ['plant/base/base-map/index', { title: '基地地图' }],
            ['plant/base/gap-base-info/index', { title: 'GAP基地信息' }],
            ['plant/base/gap-base-info-edit/index', { title: '添加GAP基地信息' }],
            ['plant/base/gap-base-info-detail/index', { title: 'GAP基地详情' }],
            ['plant/base/mark-swyq-base/index', { title: '标记三无一全基地' }],
            ['plant/base/mark-swyq-base-detail/index', { title: '三无一全基地详情' }],
            // 主营物种 plant/species
            ['plant/species/config/index', { title: '配置主营物种' }],
            // 种养殖 plant/port
            ['plant/port/port-create/index', { title: '创建种养殖任务' }],
            // 库存 plant/storage
            ['plant/storage/storage-room/list/index', { title: '库房管理' }],
            ['plant/storage/storage-room/edit/index', { title: '新增库房' }],
            ['plant/storage/storage-room/detail/index', { title: '库房详情' }],
            // 通用工具 tools
            ['tools/map-draw-area/index', { title: '地图绘制面积图' }],
            ['tools/map-gd/index', { title: '地图绘制面积图' }],
            ['tools/select-cpy-member/index', { title: '选择企业成员' }],
            ['tools/select-medicine/index', { title: '选择获评品种' }],
            ['tools/select-gap-info/index', { title: '选择GAP获评信息' }],
            ['tools/por-torganism/index', { title: '选择动植物类型' }],
            // 审核端 audit/plant
            ['audit/plant/base/audit-list/index', { title: '基地审核列表' }],
            ['audit/plant/base/audit-detail/index', { title: '基地审核详情' }],
        ]));
        // 设置页面标题
        function setPageTitle(route: string, title: string) {
            mapPages.value.set(route, { title });
        }
        return { mapPages, setPageTitle };
    });
