package com.reading.platform.common.enums;

import lombok.Getter;

/**
 * Task Type Enum
 */
@Getter
public enum TaskType {

    READING("reading", "Reading Task"),
    HOMEWORK("homework", "Homework"),
    ACTIVITY("activity", "Activity"),
    OTHER("other", "Other");

    private final String code;
    private final String description;

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

    public static TaskType fromCode(String code) {
        for (TaskType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return OTHER;
    }

}
