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

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

/**
 * Created by lihualong on 2017/6/19.
 */
@Entity(nameInDb = "DB_DOWNLOAD")
public class DownloadData {
    /**
     * id : b69d6e5677564363881dbd3bbe5104c4
     * dataname : 管维分公司管网
     * filename : 0017_pipe.geodatabase
     * filetype : .geodatabase
     * datasize : 0
     * datatype : 管网
     * updatetime : 2017-03-06T22:09:29
     * status : 3
     * downloadtime : 0000-00-00 00:00:00
     */
//    @Id @NotNull
//    private String id;
//    private String dataname;
//    private String filename;
//    private String filetype;
//    private long datasize;
//    private String datatype;
//    private String updatetime;
//    private String status;
//    private String downloadtime;
//    private String userId;
//    private int download_state;

    @Id
    @NotNull
    private String id;
    private String pid;
    private String name;
    private String cval;
    private String createTime;
    private String updatetime;
    private String createUser;
    private String ckey;
    private String filetype;
    private String datasize;
    private String datatype;
    private String downloadTime;
    private int download_state;

    @Generated(hash = 1387635939)
    public DownloadData(@NotNull String id, String pid, String name, String cval,
            String createTime, String updatetime, String createUser, String ckey,
            String filetype, String datasize, String datatype, String downloadTime,
            int download_state) {
        this.id = id;
        this.pid = pid;
        this.name = name;
        this.cval = cval;
        this.createTime = createTime;
        this.updatetime = updatetime;
        this.createUser = createUser;
        this.ckey = ckey;
        this.filetype = filetype;
        this.datasize = datasize;
        this.datatype = datatype;
        this.downloadTime = downloadTime;
        this.download_state = download_state;
    }

    @Generated(hash = 664927048)
    public DownloadData() {
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPid() {
        return this.pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCval() {
        return this.cval;
    }

    public void setCval(String cval) {
        this.cval = cval;
    }

    public String getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdatetime() {
        return this.updatetime;
    }

    public void setUpdatetime(String updatetime) {
        this.updatetime = updatetime;
    }

    public String getCreateUser() {
        return this.createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getCkey() {
        return this.ckey;
    }

    public void setCkey(String ckey) {
        this.ckey = ckey;
    }

    public String getFiletype() {
        return this.filetype;
    }

    public void setFiletype(String filetype) {
        this.filetype = filetype;
    }

    public String getDatasize() {
        return this.datasize;
    }

    public void setDatasize(String datasize) {
        this.datasize = datasize;
    }

    public String getDatatype() {
        return this.datatype;
    }

    public void setDatatype(String datatype) {
        this.datatype = datatype;
    }

    public String getDownloadTime() {
        return this.downloadTime;
    }

    public void setDownloadTime(String downloadTime) {
        this.downloadTime = downloadTime;
    }

    public int getDownload_state() {
        return this.download_state;
    }

    public void setDownload_state(int download_state) {
        this.download_state = download_state;
    }
    

    public enum Download_State {
        /*未知状态*/
        STATE_UNKNOWN(0),
        /*已下载*/
        STATE_DOWNLOADED(1),
        /*下载失败*/
        STATE_DOWNLOAD_FAILED(2),
        /*未下载*/
        STATE_NOT_DOWNLOAD(3),
        /*正在下载*/
        STATE_DOWNLOADING(4);

        public final int nativeInt;

        private static Download_State states[] = {STATE_UNKNOWN,
                STATE_DOWNLOADED, STATE_DOWNLOAD_FAILED, STATE_NOT_DOWNLOAD, STATE_DOWNLOADING
        };

        Download_State(int state) {
            nativeInt = state;
        }

        static Download_State nativeToState(int state) {
            return states[state];
        }

        public boolean isEqual(int status) {
            return nativeInt == status;
        }
    }

    public enum Server_Status {
        /*未知状态*/
        STATUS_UNKNOWN(-1),
        /*正在生成*/
        STATUS_GENERATING(0),
        /*正在更新*/
        STATUS_UPDATING(1),
        /*已更新*/
        STATUS_UPDATED(2),
        /*不可用*/
        STATUS_NOT_USEABLE(3);


        public final int nativeInt;

        private static Server_Status statuses[] = {STATUS_UNKNOWN,
                STATUS_GENERATING, STATUS_UPDATING, STATUS_UPDATED, STATUS_NOT_USEABLE
        };

        Server_Status(int state) {
            nativeInt = state;
        }

        static Server_Status nativeToStatus(int status) {
            return statuses[status];
        }

        public boolean isEqual(int status) {
            return nativeInt == status;
        }
    }

}
