package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 作品状态枚举
 */
@Getter
@AllArgsConstructor
public enum WorkStatusEnum {

    SUBMITTED("submitted", "已提交"),
    LOCKED("locked", "已锁定"),
    REVIEWING("reviewing", "评审中"),
    REJECTED("rejected", "已拒绝"),
    ACCEPTED("accepted", "已接受");

    private final String code;
    private final String desc;

    public static WorkStatusEnum getByCode(String code) {
        if (code == null) {
            return SUBMITTED;
        }
        for (WorkStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return SUBMITTED;
    }
}
