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

export default class TrueFalseTagStyleFormatter {

    trueFalseTagStyle: INumberValueTagStyle[] = [
        {value: 1, label: '是', type: 'success'},
        {value: 0, label: '否', type: 'warning'},
    ];

   canUseTagStyle: INumberValueTagStyle[] = [
        {value: 1, label: '启用', type: 'success'},
        {value: 0, label: '停用', type: 'warning'},
    ];

    // 格式化是否启用的tag
    canUseTagStyleFormatter(value: any) : INumberValueTagStyle {
        const findResult = this.canUseTagStyle.find(f => f.value == value);
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    };

    // 格式化是否的tag
    yesOrNoTagStyleFormatter(value: any) : INumberValueTagStyle {
        const findResult = this.trueFalseTagStyle.find(f => f.value == value);
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    }

}