package com.lesingle.edu.common.enums;

import lombok.Getter;

/**
 * 课程状态枚举
 */
@Getter
public enum CourseStatus {

    DRAFT("DRAFT", "草稿"),
    /** 表单已完整保存、可提交审核或直接发布，与草稿区分 */
    UNSUBMITTED("UNSUBMITTED", "未提交"),
    PENDING("PENDING", "待审核"),
    REJECTED("REJECTED", "已驳回"),
    PUBLISHED("PUBLISHED", "已发布"),
    ARCHIVED("ARCHIVED", "已下架"),
    APPROVED("APPROVED", "审核通过");

    private final String code;
    private final String description;

    CourseStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static CourseStatus fromCode(String code) {
        for (CourseStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return DRAFT;
    }

}
