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

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
 * Created by Amu on 2017/5/3.
 */

@SuppressWarnings("serial")
public class InMessageBean implements Serializable {
    /**
     * id : 17E486E311B941C9BD2F834DD9B1435D
     * read_time : null
     * send_time : 2017-05-03T12:09:35
     * send_userid : 1
     * send_username : 管理员
     * send_usertype : null
     * msgcontent : 5
     * isread : 0
     * url : null
     * avatar : /Upload/Avatar/9e77e176-d954-4c79-994b-c1dda2f45a63.jpg
     * extends : null
     * files : [{"id":"325C0214F4CB4479A57542615A9DD4C9","filename":"Upload/2017-05/e9c30e78-736b-4f95-922e-2e5a916eae33.png","filelength":7154,"filetype":"image/png","audiolength":"0"}]
     */

    public static final String ADMIN_USER_ID = "1";
    public static final String ADMIN_USER_NAME = "管理员";

    public static final String MESSAGE_MODULE_KEY = "module";

    public enum File_Type {
        /*未知状态*/
        FILE_TYPE_AUDIO(0),
        /*已下载*/
        FILE_TYPE_IMAGE(1),
        /*下载失败*/
        FILE_TYPE_OTHERS(2);

        public final int type;

        private static File_Type states[] = {FILE_TYPE_AUDIO, FILE_TYPE_IMAGE, FILE_TYPE_OTHERS};

        File_Type(int type) {
            this.type = type;
        }

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

        public boolean isEqual(File_Type status) {
            return this == status;
        }
    }

//    @SerializedName("id")
//    private String id;
//    private String read_time;
//    private String send_time;
//    private String send_userid;
//    private String send_username;
//    private String send_usertype;
//    private String msgcontent;
//    private int isread;
//    private String url;
//    private String avatar;
//    private String extend;
//    private List<FilesBean> files;
//
//    public String getId() {
//        return id;
//    }
//
//    public void setId(String id) {
//        this.id = id;
//    }
//
//    public String getRead_time() {
//        return read_time;
//    }
//
//    public void setRead_time(String read_time) {
//        this.read_time = read_time;
//    }
//
//    public String getSend_time() {
//        return send_time;
//    }
//
//    public void setSend_time(String send_time) {
//        this.send_time = send_time;
//    }
//
//    public String getSend_userid() {
//        return send_userid;
//    }
//
//    public void setSend_userid(String send_userid) {
//        this.send_userid = send_userid;
//    }
//
//    public String getSend_username() {
//        return send_username;
//    }
//
//    public void setSend_username(String send_username) {
//        this.send_username = send_username;
//    }
//
//    public String getSend_usertype() {
//        return send_usertype;
//    }
//
//    public void setSend_usertype(String send_usertype) {
//        this.send_usertype = send_usertype;
//    }
//
//    public String getMsgcontent() {
//        return msgcontent;
//    }
//
//    public void setMsgcontent(String msgcontent) {
//        this.msgcontent = msgcontent;
//    }
//
//    public int getIsread() {
//        return isread;
//    }
//
//    public void setIsread(int isread) {
//        this.isread = isread;
//    }
//
//    public String getUrl() {
//        return url;
//    }
//
//    public void setUrl(String url) {
//        this.url = url;
//    }
//
//    public String getAvatar() {
//        return avatar;
//    }
//
//    public void setAvatar(String avatar) {
//        this.avatar = avatar;
//    }
//
//    public String getExtend() {
//        return extend;
//    }
//
//    public void setExtend(String extend) {
//        this.extend = extend;
//    }
//
//    public List<FilesBean> getFiles() {
//        return files;
//    }
//
//    public void setFiles(List<FilesBean> files) {
//        this.files = files;
//    }

    private String flag;
    private String recipientTime;
    private String messageId;
    private int createUser;
    private String createUserName;
    private String message;
    private int rowId;
    private String createDate;
    private String receiptUserAvatar;
    private String createUserAvatar;
    private String type;//0、普通消息；1、抢维修；2、巡检；3、工地；4、隐患；5、官网工单
    private String module;


    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getReceiptUserAvatar() {
        return receiptUserAvatar;
    }

    public void setReceiptUserAvatar(String receiptUserAvatar) {
        this.receiptUserAvatar = receiptUserAvatar;
    }

    public String getCreateUserAvatar() {
        return createUserAvatar;
    }

    public void setCreateUserAvatar(String createUserAvatar) {
        this.createUserAvatar = createUserAvatar;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public String getRecipientTime() {
        return recipientTime;
    }

    public void setRecipientTime(String recipientTime) {
        this.recipientTime = recipientTime;
    }

    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public int getCreateUser() {
        return createUser;
    }

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

    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getRowId() {
        return rowId;
    }

    public void setRowId(int rowId) {
        this.rowId = rowId;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public static class FilesBean implements Serializable {
        /**
         * id : 325C0214F4CB4479A57542615A9DD4C9
         * filename : Upload/2017-05/e9c30e78-736b-4f95-922e-2e5a916eae33.png
         * filelength : 7154
         * filetype : image/png
         * audiolength : 0
         */

        @SerializedName("id")
        private String id;
        private String filename;
        private int filelength;
        private String filetype;
        private String audiolength;

        public String getId() {
            return id;
        }

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

        public String getFilename() {
            return filename;
        }

        public void setFilename(String filename) {
            this.filename = filename;
        }

        public int getFilelength() {
            return filelength;
        }

        public void setFilelength(int filelength) {
            this.filelength = filelength;
        }

        public String getFiletype() {
            return filetype;
        }

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

        public String getAudiolength() {
            return audiolength;
        }

        public void setAudiolength(String audiolength) {
            this.audiolength = audiolength;
        }

        public File_Type getFileType() {
            File_Type file_type = File_Type.FILE_TYPE_OTHERS;
            if (filetype != null && !filetype.isEmpty()) {
                if (filetype.startsWith("audio")) {
                    file_type = File_Type.FILE_TYPE_AUDIO;
                } else if (filetype.startsWith("image")) {
                    file_type = File_Type.FILE_TYPE_IMAGE;
                }
            }
            return file_type;
        }
    }
}
