package com.fs.course.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum CourseWatchLogTypeEnum {

    TYPE_1(1,"看课中"),
    TYPE_2(2,"已完课"),
    TYPE_3(3,"待看课");

    private Integer value;
    private String desc;

    public static CourseWatchLogTypeEnum toType(Integer value) {
        return Stream.of(CourseWatchLogTypeEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(null);
    }
}
