package cn.iocoder.yudao.module.mes.controller.admin.dvrepair.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 单据状态枚举
 */
@Getter
@AllArgsConstructor
public enum MoldRecordStatusEnum {

    PENDING(0, "待完成"),
    COMPLETED(1, "已完成"),
    // 可以根据需要添加其他状态
    CANCELED(2, "已取消");

    @JsonValue
    private final Integer code;
    private final String name;

    @JsonCreator
    public static MoldRecordStatusEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (MoldRecordStatusEnum status : MoldRecordStatusEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}