package cn.com.ty.lift.common.model;

import cn.com.ty.lift.common.utils.ValuePool;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author huangyuan
 * @date 2020/4/17
 * @description 推送模块用户信息
 */
@Data
@NoArgsConstructor
public class PushUserInfo implements Serializable {

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 用户名
     */
    private String userName;

    /**
     * 用户手机号
     */
    private String mobile;

    /**
     * 设备型号
     */
    private Integer deviceModel;

    /**
     * 设备标识
     */
    private String deviceFlag;

    /**
     * 角色名称
     */
    private String roleName;

    public boolean available(){
        return Objects.nonNull(this.deviceModel) && Objects.nonNull(this.deviceFlag);
    }

    public boolean isAndroid(){
        return ValuePool.nullable(this.getDeviceModel(), 0) == ValuePool.PUSH_DEVICE_MODEL_ANDROID;
    }

    public boolean isIos(){
        return ValuePool.nullable(this.getDeviceModel(), 0) == ValuePool.PUSH_DEVICE_MODEL_IOS;
    }

    public PushUserInfo(Integer deviceModel, String deviceFlag) {
        this.deviceModel = deviceModel;
        this.deviceFlag = deviceFlag;
    }
}
