package com.dxhy.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author jiaohongyang
 */
public enum JxszcYyEnum {

    /**
     * 免税项目用
     */
    MSZY("1", 1),
    /**
     * 集体福利,个人消费
     */
    GRXF("2", 2),
    /**
     * 非正常损失
     */
    FZCSS("3", 3),
    /**
     * 简易计税方法征税项目用
     */
    ZSXM("4", 4),
    /**
     * 免抵退税办法不得抵扣的进项税额
     */
    BKDK("5", 5),
    /**
     * 纳税检查调减进项税额
     */
    JXSTJ("6", 6),
    /**
     * 红字专用发票通知单注明的进项税额
     */
    HZTZD("7", 7),
    /**
     * 上期留抵税额抵减欠税
     */
    SQLD("8", 8);

    private static final String[] ZCYYMC = {"免税项目用", "集体福利,个人消费", "非正常损失", "简易计税方法征税项目用", "免抵退税办法不得抵扣的进项税额",
        "纳税检查调减进项税额", "红字专用发票通知单注明的进项税额", "上期留抵税额抵减欠税"};

    private String zcyyDm;
    private int index;

    JxszcYyEnum(String zcyyDm, int index) {
        this.zcyyDm = zcyyDm;
        this.index = index;
    }

    public String getZcyyDm(int index) {
        for (JxszcYyEnum zcyy : JxszcYyEnum.values()) {
            if (zcyy.getIndex() == index) {
                return zcyy.zcyyDm;
            }
        }
        return null;
    }

    public String getZcyyMc(int index) {
        int length = ZCYYMC.length;
        if (index <= length) {
            return ZCYYMC[index - 1];
        }
        return null;
    }

    /**
     * 枚举放入map中，便于取用
     */
    public static Map<String, String> getEnumMap() {
        Map<String, String> enumMap = new HashMap<>(16);
        for (JxszcYyEnum en : JxszcYyEnum.values()) {
            enumMap.put(en.getZcyyDm(), en.getZcyyMc(en.getIndex()));
        }
        return enumMap;
    }

    public String getZcyyDm() {
        return zcyyDm;
    }

    public void setZcyyDm(String zcyyDm) {
        this.zcyyDm = zcyyDm;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
