package com.ruoyi.cai.enums;

import lombok.Getter;

/**
 * 1.文本 2.语音 3.图片 4.视频 100 。自定义
 * <p>created on 2024/1/8 18:09</p>
 * @author duet
 */
public enum ImTypeEnum {
    MESSAGE(1,0),
    VOICE(2,2),
    PICTURE(3,1),
    VIDEO(4,3),
    CUSTOM(100,100)
    ;

    @Getter
    private final Integer imType;
    @Getter
    private final Integer yunxinType;

    ImTypeEnum(Integer imType, Integer yunxinType) {
        this.imType = imType;
        this.yunxinType = yunxinType;
    }

    public boolean isFileType(){
        if(this.getImType().equals(2) || this.getImType().equals(3) || this.getImType().equals(4)){
            return true;
        }
        return false;
    }

    public static ImTypeEnum getByType(Integer imType){
        ImTypeEnum[] values = ImTypeEnum.values();
        for (ImTypeEnum value : values) {
            if(value.getImType().equals(imType)){
                return value;
            }
        }
        return null;
    }
}
