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

export default class UserTagStyleFormatter {

    userStatusTagStyle: IStringValueTagStyle[] = [
        {value: '0', label: '待激活', type: 'info'},
        {value: '1', label: '正常', type: 'success'},
        {value: '3', label: '冻结', type: 'warning'},
        {value: '4', label: '禁用', type: 'danger'},
    ];

    userLevelTagStyle: IStringValueTagStyle[] = [
        {value: '0', label: '普通', type: 'info'},
        {value: '1', label: '中级', type: 'success'},
        {value: '3', label: '高级', type: 'warning'},
        {value: '4', label: '顶级', type: 'danger'},
    ];

    userOnlineTagStyle: IStringValueTagStyle[] = [
        {value: '0', label: '离线', type: 'info'},
        {value: '1', label: '在线', type: 'success'},
    ];

    userSexTagStyle: IStringValueTagStyle[] = [
        {value: '0', label: '保密', type: 'info'},
        {value: '1', label: '男', type: 'primary'},
        {value: '2', label: '女', type: 'success'},
    ]

    // 格式化用户状态
    userStatusTagStyleFormatter(value: any) : IStringValueTagStyle {
        const findResult = this.userStatusTagStyle.find(f => f.value === value.toString());
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    };
    // 格式化用户等级
    userLevelTagStyleFormatter(value: any) : IStringValueTagStyle {
        const findResult = this.userLevelTagStyle.find(f => f.value === value.toString());
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    };
    // 格式化在线离线信息
    userOnlineTagStyleFormatter(value: any) : IStringValueTagStyle {
        const findResult = this.userOnlineTagStyle.find(f => f.value === value.toString());
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    };
    // 格式化用户性别
    userSexTagStyleFormatter(value: any) : IStringValueTagStyle {
        const findResult = this.userSexTagStyle.find(f => f.value === value.toString());
        if (findResult) {
            return findResult;
        }
        return {value: value.toString(), label: '？' + value.toString(), type: 'danger'};
    };
}