package com.hotwj.platform.noticeManagerment.systemNotification.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 消息来源类型
 * <p>
 */
@Getter
@RequiredArgsConstructor
public enum SourceType {
    COMPANY(1L, "企业"), //
    CAR(2L, "车辆"),
    DRIVER(3L, "驾驶员"),
    SYSTEM(4L, "制度与会议"),
    DANGER(5L, "隐患"),
    VIOLATION(6L, "违规"),
    INTERVIEW(7L, "约谈"),
    TRAINING(8L, "培训"),
    SUGGESTION(9L, "投诉建议");

    /**
     * 类型
     */
    private final Long type;
    /**
     * 类型名
     */
    private final String name;

    public static SourceType toType(Long type) {
        return Stream.of(SourceType.values()).filter(p -> Objects.equals(p.type, type)).findAny().orElse(null);
    }

}
