package com.reading.platform.common.enums;

import lombok.Getter;

/**
 * Course Status Enum
 */
@Getter
public enum CourseStatus {

    DRAFT("draft", "Draft"),
    PUBLISHED("published", "Published"),
    ARCHIVED("archived", "Archived");

    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;
    }

}
