package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 作业提交状态枚举
 */
@Getter
@AllArgsConstructor
public enum HomeworkSubmissionStatusEnum {

    PENDING("pending", "待评审"),
    REVIEWED("reviewed", "已评审"),
    REJECTED("rejected", "已拒绝");

    private final String code;
    private final String desc;

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