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

// 报警信息基础资料设备类型格式化
export default class ErrorBaseEquipmentTypeFormatter {

    equipmentType: INumberValueTagStyle[] = [
        {value: 0, label: "堆垛机", type: "primary"},
        {value: 1, label: "托盘线", type: "info"},
        {value: 2, label: "箱式线", type: "success"},
        {value: 3, label: "小车", type: "warning"},
    ];

    errorBaseEquipmentTypeFormatter(value: any): INumberValueTagStyle {
        if(value == null) {
            return {value: -1, label: '?', type: 'danger'};
        }
        const findResult = this.equipmentType.find(f => f.value == value);
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    }
}