package com.fs.crm.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum CustomerLogEnum {
    ASSIGN_COMPANY(1,"分配公司"),
    ASSIGN_DEPT(2,"分配部门"),
    RECEIVE(3,"认领"),
    RECOVER(4,"回收"),
    ASSIGN_USER(5,"分配员工"),
    CANCEL_ASSIGN(6,"撤销分配"),
    ASSIST_USER(7,"添加协作人");

    private Integer value;
    private String desc;

    public static CustomerLogEnum toType(String value) {
        return Stream.of(CustomerLogEnum.values())
                .filter(p -> p.value.equals(value))
                .findAny()
                .orElse(null);
    }

    public static String getDesc(String value) {
        return toType(value) == null ? null : toType(value).desc;
    }
}
