package com.prolog.cs.biz.outbound.model.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum OUT_BILL_TYPE {
    OUT_SALE("1", "销售出库"),
    OUT_PROXY("2", "代管出库"),
    OUT_MOVE("3", "移库出库"),
    OUT_DISPATCH("4", "调拨出库"),
    OUT_DIRECT("5", "直调出库"),
    OUT_EQUIPMENT("6", "器械出库"),
    OUT_STAGE("7", "发货暂存"),
    OUT_SPOT_CHECK("8", "抽检出库"),
    OUT_OTHER("9", "其它出库"),
    OUT_SALE_OUT("10", "采购退出");

    @JsonCreator
    public static OUT_BILL_TYPE getOutBillStatusEnum(final String codeValue) {
        for (OUT_BILL_TYPE e : values()) {
            if (e.code.equals(codeValue)) {
                return e;
            }
        }
        return null;
    }

    public static String getName(final String codeValue) {
        for (OUT_BILL_TYPE e : values()) {
            if (e.code.equals(codeValue)) {
                return e.name;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return code;
    }


    public String getCode() {
        return code;
    }

    @JsonValue
    public String getName() {
        return name;
    }

    private String code;
    private String name;

    OUT_BILL_TYPE(String code, String name) {
        this.code = code;
        this.name = name;
    }

}
