package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 作业状态枚举
 */
@Getter
@AllArgsConstructor
public enum HomeworkStatusEnum {

    UNPUBLISHED("unpublished", "未发布"),
    PUBLISHED("published", "已发布");

    private final String code;
    private final String desc;

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