package com.goafanti.common.model;

import com.goafanti.common.constant.AFTConstants;
import com.goafanti.common.enums.NoticeStatus;
import com.goafanti.common.enums.NoticeTypes;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

public class Notice implements Serializable {
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.id
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private String id;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.aid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private String aid;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.notice_type
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private Integer noticeType;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.content
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private String content;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.create_time
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private Date createTime;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.readed
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private Integer readed;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.uid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private String uid;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.pid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private String pid;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.rid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private String rid;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.year
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private Integer year;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column notice.type
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private Integer type;

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database table notice
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.id
	 * @return  the value of notice.id
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public String getId() {
		return id;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.id
	 * @param id  the value for notice.id
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setId(String id) {
		this.id = id == null ? null : id.trim();
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.aid
	 * @return  the value of notice.aid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public String getAid() {
		return aid;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.aid
	 * @param aid  the value for notice.aid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setAid(String aid) {
		this.aid = aid == null ? null : aid.trim();
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.notice_type
	 * @return  the value of notice.notice_type
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public Integer getNoticeType() {
		return noticeType;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.notice_type
	 * @param noticeType  the value for notice.notice_type
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setNoticeType(Integer noticeType) {
		this.noticeType = noticeType;
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.content
	 * @return  the value of notice.content
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public String getContent() {
		return content;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.content
	 * @param content  the value for notice.content
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setContent(String content) {
		this.content = content == null ? null : content.trim();
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.create_time
	 * @return  the value of notice.create_time
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public Date getCreateTime() {
		return createTime;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.create_time
	 * @param createTime  the value for notice.create_time
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.readed
	 * @return  the value of notice.readed
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public Integer getReaded() {
		return readed;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.readed
	 * @param readed  the value for notice.readed
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setReaded(Integer readed) {
		this.readed = readed;
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.uid
	 * @return  the value of notice.uid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public String getUid() {
		return uid;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.uid
	 * @param uid  the value for notice.uid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setUid(String uid) {
		this.uid = uid == null ? null : uid.trim();
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.pid
	 * @return  the value of notice.pid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public String getPid() {
		return pid;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.pid
	 * @param pid  the value for notice.pid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setPid(String pid) {
		this.pid = pid == null ? null : pid.trim();
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.rid
	 * @return  the value of notice.rid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public String getRid() {
		return rid;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.rid
	 * @param rid  the value for notice.rid
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setRid(String rid) {
		this.rid = rid == null ? null : rid.trim();
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.year
	 * @return  the value of notice.year
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public Integer getYear() {
		return year;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.year
	 * @param year  the value for notice.year
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setYear(Integer year) {
		this.year = year;
	}
	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column notice.type
	 * @return  the value of notice.type
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public Integer getType() {
		return type;
	}
	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column notice.type
	 * @param type  the value for notice.type
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	public void setType(Integer type) {
		this.type = type;
	}
	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table notice
	 * @mbg.generated  Thu May 27 17:22:58 CST 2021
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", aid=").append(aid);
		sb.append(", noticeType=").append(noticeType);
		sb.append(", content=").append(content);
		sb.append(", createTime=").append(createTime);
		sb.append(", readed=").append(readed);
		sb.append(", uid=").append(uid);
		sb.append(", pid=").append(pid);
		sb.append(", rid=").append(rid);
		sb.append(", year=").append(year);
		sb.append(", type=").append(type);
		sb.append(", serialVersionUID=").append(serialVersionUID);
		sb.append("]");
		return sb.toString();
	}



	public Notice() {};
//	Readed(0);//未读
//	 n.setAid("1");
//	 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
//	 n
	/**
	 *
	 * @param id 编号
	 * @param createTime 创建时间
	 * @param readed 0未读
	 * @param aid 发件人
	 * @param noticeType 标题
	 * @param content  内容
	 */
	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content,String uid) {
		this.id=id;
		this.createTime=createTime;
		this.readed=readed;
		this.aid=aid;
		this.noticeType=noticeType;
		this.content=content;
		this.uid=uid;
	}


	/**
	 *
	 * @param id 编号
	 * @param createTime 创建时间
	 * @param readed 0未读
	 * @param aid 发件人
	 * @param noticeType 标题
	 * @param content  内容
	 */
	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content) {
		this.id=id;
		this.createTime=createTime;
		this.readed=readed;
		this.aid=aid;
		this.noticeType=noticeType;
		this.type= NoticeTypes.getType(noticeType);
		this.content=content;
	}

	/**
	 *
	 * @param aid 接收人
	 * @param noticeType 接受类型
	 * @param content 内容
	 */
	public Notice(String aid,Integer noticeType,String content) {
		this.id= UUID.randomUUID().toString();
		this.createTime=new Date();
		this.readed=0;
		this.aid=aid;
		this.noticeType=noticeType;
		this.type= NoticeTypes.getType(noticeType);
		this.content=content;
	}



	public String getNoticeTypeName(){
		if (null == this.noticeType)return null;
		return NoticeStatus.getValueByCode(this.noticeType);
	}

	public void setNoticeTypeName(Integer noticeType){

	}

	public String getCreateTimeFormattedDate() {
		if (this.createTime == null) {
			return null;
		} else {
			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
		}
	}

	public void setCreateTimeFormattedDate(String createTimeFormattedDate) {

	}


}
