package com.tofly.ghrq_route.module.user.domain;

import com.google.gson.annotations.SerializedName;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.Unique;

@Entity(nameInDb = "DB_USER")
public class UserBean {

    /**
     * userid : 1
     * username : 管理员
     * avatar : /Upload/Avatar/9e77e176-d954-4c79-994b-c1dda2f45a63.jpg
     * companyid : null
     * depid : null
     * loginid : admin
     * logintime : 2017-02-05T00:00:00
     * mobile : null
     * online : null
     * pdaid : null
     * roleid : null
     * state : null
     */

    public final static int PATROL_TYPE_WALK = 0;
    public final static int PATROL_TYPE_CAR = 1;

    public enum PDA_BIND_STATUS {
        PDA_UNBIND(0),  //未绑定
        PDA_BINDED(1),  //已绑定
        PDA_BINDED_OTHER(2);  //绑定其它账号

        PDA_BIND_STATUS(int status) {
            this.status = status;
        }

        public int getStatus() {
            return status;
        }

        public static PDA_BIND_STATUS Status(int status) {
            switch (status) {
                case 0:
                    return PDA_UNBIND;
                case 1:
                    return PDA_BINDED;
                case 2:
                    return PDA_BINDED_OTHER;
            }
            return PDA_UNBIND;
        }

        final int status;
    }

    @Id @NotNull @Unique
    @SerializedName(value = "userid", alternate = "id")
    private String userid;
    private String username;
    private String password;
    @SerializedName(value = "token", alternate = "accessToken")
    private String token;
    private String avatar;
    private String realName;
    private String userLevel;
    private String companyid;
    private String company_name;
    private String departmentId;
    private String departmentName;
    private String logintime;
    @SerializedName(value = "mobile", alternate = "phone")
    private String mobile;
    @SerializedName(value = "online", alternate = "online_state")
    private String online;
    private String pdaid;
    @SerializedName(value = "state", alternate = "statusFlag")
    private String state = "0";   //是否启用禁用，1启用，0禁用
    private int patrol_type;
    private String carid;
    private String plate_number;
    private int car_mode;   //车讯模式 0：未开启 1：开启


    @Generated(hash = 307076580)
    public UserBean(@NotNull String userid, String username, String password,
            String token, String avatar, String realName, String userLevel,
            String companyid, String company_name, String departmentId,
            String departmentName, String logintime, String mobile, String online,
            String pdaid, String state, int patrol_type, String carid,
            String plate_number, int car_mode) {
        this.userid = userid;
        this.username = username;
        this.password = password;
        this.token = token;
        this.avatar = avatar;
        this.realName = realName;
        this.userLevel = userLevel;
        this.companyid = companyid;
        this.company_name = company_name;
        this.departmentId = departmentId;
        this.departmentName = departmentName;
        this.logintime = logintime;
        this.mobile = mobile;
        this.online = online;
        this.pdaid = pdaid;
        this.state = state;
        this.patrol_type = patrol_type;
        this.carid = carid;
        this.plate_number = plate_number;
        this.car_mode = car_mode;
    }

    @Generated(hash = 1203313951)
    public UserBean() {
    }


    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getCompanyid() {
        return companyid;
    }

    public void setCompanyid(String companyid) {
        this.companyid = companyid;
    }

    public String getLogintime() {
        return logintime;
    }

    public void setLogintime(String logintime) {
        this.logintime = logintime;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getOnline() {
        return online;
    }

    public void setOnline(String online) {
        this.online = online;
    }

    public String getPdaid() {
        return pdaid;
    }

    public void setPdaid(String pdaid) {
        this.pdaid = pdaid;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getToken() {
        return this.token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public int getPatrol_type() {
        return this.patrol_type;
    }

    public void setPatrol_type(int patrol_type) {
        this.patrol_type = patrol_type;
    }

    public String getCarid() {
        return this.carid;
    }

    public void setCarid(String carid) {
        this.carid = carid;
    }

    public boolean isCarMode(){
        return this.car_mode == PATROL_TYPE_CAR;
    }

    public String getCompany_name() {
        return this.company_name;
    }

    public void setCompany_name(String company_name) {
        this.company_name = company_name;
    }

    public String getPlate_number() {
        return this.plate_number;
    }

    public void setPlate_number(String plate_number) {
        this.plate_number = plate_number;
    }

    public int getCar_mode() {
        return this.car_mode;
    }

    public void setCar_mode(int car_mode) {
        this.car_mode = car_mode;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealName() {
        return this.realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getUserLevel() {
        return this.userLevel;
    }

    public void setUserLevel(String userLevel) {
        this.userLevel = userLevel;
    }

    public String getDepartmentId() {
        return this.departmentId;
    }

    public void setDepartmentId(String departmentId) {
        this.departmentId = departmentId;
    }

    public String getDepartmentName() {
        return this.departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }
}
