import type {IStringValueTagStyle} from "@/interface/app/ITagStyle.ts";

export default class MenuTagStyleFormatter {

    menuLevelTagStyle: IStringValueTagStyle[] = [
        {value: '1', label: '一级菜单', type: 'primary'},
        {value: '2', label: '二级菜单', type: 'info'},
    ];

    menuStatusTagStyle: IStringValueTagStyle[] = [
        {value: '1', label: '启用', type: 'success'},
        {value: '0', label: '停用', type: 'danger'},
    ]

    // 格式化菜单等级的tag
    menuLevelTagStyleFormatter(value: any) : IStringValueTagStyle {
        const findResult = this.menuLevelTagStyle.find(f => f.value === value.toString());
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    }
    // 格式化菜单状态的tag
    menuStatusTagStyleFormatter(value: any) : IStringValueTagStyle {
        const findResult = this.menuStatusTagStyle.find(f => f.value === value.toString());
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    }

}