package cn.superdesk.uniorder.common.enums.invoice;

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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/7/30 上午11:00
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/7/30 上午11:00
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceInvoicedOperationLogOperationTypeEnum {

	UNKNOW(666666, "UNKNOW", "未知操作"),

	/****************************************** 红冲 start ******************************************/

	/****************************************** 作废 start ******************************************/

	/****************************************** 软删除 start ******************************************/

	/****************************************** 回款 start ******************************************/
	回款操作_未回款(400000, "InvoiceInvoicedFieldIsBackCollection->opInitOrResetByStateMachine", "回款操作_未回款"),
	回款操作_部分回款(400001, "InvoiceInvoicedFieldIsBackCollection->opPartByStateMachine", "回款操作_部分回款"),
	回款操作_已回款(400002, "InvoiceInvoicedFieldIsBackCollection->opCompleteByStateMachine", "回款操作_已回款"),
	回款操作_红冲发票(400069, "InvoiceInvoicedFieldIsBackCollection->opRedWriteOffByStateMachine", "回款操作_红冲发票"),

	/****************************************** 逾期检查 start ******************************************/
	逾期检查(500000, "InvoiceInvoicedFieldIsOverdue->opOverduedByStateMachine", "逾期检查"),

	/****************************************** 编辑操作 start ******************************************/
	编辑操作(666666, "InvoiceInvoicedUpdateOpFields->updateOpFields", "编辑操作"),
	编辑操作_调整组织关系(600000, "InvoiceInvoicedBatchUpdateFields->batchUpdateFields", "编辑操作_调整组织关系"),
	编辑操作_更新备注(700000, "InvoiceInvoicedUpdateOpRemark->updateOpRemark", "编辑操作_更新备注"),

	/****************************************** 导入操作 start ******************************************/
	导入操作(800000, "InvoiceInvoicedExcelImportAndStore", ""),
	导入操作_导入应收(800010, "InvoiceInvoicedExcelImportAndStoreOpNormal", "导入操作_导入应收"),
	导入操作_导入历史(800020, "InvoiceInvoicedExcelImportAndStoreOpHistory", "导入操作_导入历史"),
	导入操作_导入回款(800030, "InvoiceInvoicedExcelImportAndStoreOpBackCollection2", "导入操作_导入回款"),
	导入操作_忆企助手(800040, "InvoiceInvoicedExcelImportAndStoreOpYqzs17WinV30", "导入操作_忆企助手"),

	;

	private Integer operationTypeId;
	private String  operationTypeKey;
	private String  operationTypeName;

	InvoiceInvoicedOperationLogOperationTypeEnum(Integer operationTypeId, String operationTypeKey, String operationTypeName) {
		this.operationTypeId = operationTypeId;
		this.operationTypeKey = operationTypeKey;
		this.operationTypeName = operationTypeName;
	}

	public Integer getOperationTypeId() {
		return operationTypeId;
	}

	public String getOperationTypeKey() {
		return operationTypeKey;
	}

	public String getOperationTypeName() {
		return operationTypeName;
	}

	public static String getOperationTypeKeyByOperationTypeId(Integer operationTypeId) {
		for (InvoiceInvoicedOperationLogOperationTypeEnum c : InvoiceInvoicedOperationLogOperationTypeEnum.values()) {
			if (c.operationTypeId.equals(operationTypeId)) {
				return c.getOperationTypeKey();
			}
		}
		return UNKNOW.getOperationTypeKey();
	}

	public static String getOperationTypeNameByOperationTypeId(Integer operationTypeId) {
		for (InvoiceInvoicedOperationLogOperationTypeEnum c : InvoiceInvoicedOperationLogOperationTypeEnum.values()) {
			if (c.operationTypeId.equals(operationTypeId)) {
				return c.getOperationTypeName();
			}
		}
		return UNKNOW.getOperationTypeName();
	}

	public static InvoiceInvoicedOperationLogOperationTypeEnum getByOperationTypeKey(String operationTypeKey) {
		for (InvoiceInvoicedOperationLogOperationTypeEnum commonServiceEnum : InvoiceInvoicedOperationLogOperationTypeEnum.values()) {
			if (commonServiceEnum.operationTypeKey.equals(operationTypeKey)) {
				return commonServiceEnum;
			}
		}
		return InvoiceInvoicedOperationLogOperationTypeEnum.UNKNOW;
	}

	public static InvoiceInvoicedOperationLogOperationTypeEnum getByOperationTypeId(Integer operationTypeId) {
		return LOOKUP.get(operationTypeId);
	}

	private static final Map<Integer, InvoiceInvoicedOperationLogOperationTypeEnum> LOOKUP = new HashMap<>();


	static {
		for (InvoiceInvoicedOperationLogOperationTypeEnum s : EnumSet.allOf(InvoiceInvoicedOperationLogOperationTypeEnum.class)) {
			LOOKUP.put(s.getOperationTypeId(), s);
		}
	}
}
