package com.njzscloud.supervisory.biz.constant;

import com.njzscloud.common.core.ienum.Dict;
import com.njzscloud.common.core.ienum.DictStr;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 字典代码：biz_obj
 * 字典名称：业务对象
 */
@Getter
@RequiredArgsConstructor
public enum BizObj implements DictStr {
    // 产废方
    GeRen("GeRen", "个人"),
    WuYe("WuYe", "物业"),
    ShiGongDanWei("ShiGongDanWei", "施工单位"),
    ChaiQian("ChaiQian", "拆迁公司"),
    SheQu("SheQu", "社区/村/街道"),
    QiTa("QiTa", "其他"),

    // 清运方
    QiYe("QiYe", "企业"),
    GeTi("GeTi", "个体工商户"),

    SiJi("SiJi", "司机"),

    JianGuan("JianGuan", "监管"),
    SiBang("SiBang", "司磅"),

    ChanFeiDanWei("ChanFeiDanWei", "产废单位"),
    QingYunGongSi("QingYunGongSi", "清运公司"),
    ;

    private final String val;
    private final String txt;

    /**
     * 判断是否为清运公司
     */
    public static boolean isTrans(BizObj bizObj) {
        return bizObj != null && bizObj.isTrans();
    }

    /**
     * 判断是否为司机
     */
    public static boolean isDriver(BizObj bizObj) {
        return bizObj != null && bizObj.isDriver();
    }

    /**
     * 判断是否为产废单位或个人
     */
    public static boolean isWaste(BizObj bizObj) {
        return bizObj != null && (bizObj.isWastePersonal() || bizObj.isWasteCompany());
    }

    /**
     * 判断是否为个人
     */
    public static boolean isWastePersonal(BizObj bizObj) {
        return bizObj != null && bizObj.isWastePersonal();
    }

    /**
     * 判断是否为产废单位
     */
    public static boolean isWasteCompany(String bizObjStr) {
        BizObj bizObj = Dict.parse(bizObjStr, BizObj.values());
        return bizObj != null && bizObj.isWasteCompany();
    }

    /**
     * 判断是否为司磅
     */
    public static boolean isSiBang(BizObj bizObj) {
        return bizObj != null && bizObj.isSiBang();
    }

    /**
     * 判断是否为清运公司
     */
    public boolean isTrans() {
        return this == QiYe || this == GeTi;
    }

    /**
     * 判断是否为司机
     */
    public boolean isDriver() {
        return this == SiJi;
    }

    /**
     * 判断是否为个人
     */
    public boolean isWastePersonal() {
        return this == GeRen;
    }

    /**
     * 判断是否为产废单位
     */
    public boolean isWasteCompany() {
        return this == ShiGongDanWei
                || this == WuYe
                || this == ChaiQian
                || this == SheQu
                || this == QiTa;
    }

    /**
     * 判断是否为司磅
     */
    public boolean isSiBang() {
        return this == SiBang;
    }

    /**
     * 判断是否为产废单位或个人
     */
    public boolean isWaste() {
        return isWastePersonal() || isWasteCompany();
    }

}    
