// 商店表
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'

export interface DicShopType {
    // 商店id
    readonly shop: number;
    // 商店内标签，小分类
    readonly type: number;
    // 是否限时
    readonly isLimit: boolean;
}

export const dicShopType = new Map<string, DicShopType>(); // shop+type => DicShopType
export function loadShopType() {
    dicShopType.clear();
    let arr = readFileAndParse(FILENAME.DIC_SHOP_TYPE);

    arr.forEach(o => {
        o.type = o.typeid;
        if(o.shop != '&') {
            dicShopType.set(`${o.shop}_${o.type}`, o);
        }
    });
    arr = undefined;
}