package com.iformall.domain.po;

import com.iformall.domain.dto.WxCUserBasicInfoFilterDto;
import com.iformall.domain.dto.WxCUserBasicInfoFilterListDto;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Table(name = "wx_coupon_inject")
public class WxCouponInject implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	protected Long id;

	@Transient
	protected List<Long> ids;
	@Transient
	protected String sortColumns;

	public WxMsgModel getMsgModel() {
		return msgModel;
	}

	public void setMsgModel(WxMsgModel msgModel) {
		this.msgModel = msgModel;
	}

	@Transient
	protected WxMsgModel msgModel;

	@Transient
	protected Date sendTimeStart;

	@Transient
	protected Date sendTimeEnd;

	public Long getId() {
		return id;
	}

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

	public String getSortColumns() {
		return sortColumns;
	}

	public List<Long> getIds() {
		return ids;
	}

	public void setIds(List<Long> ids) {
		this.ids = ids;
	}



	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="tenantId")
	private String tenantId;
	/*任务名称**/
	@io.swagger.annotations.ApiModelProperty(value="任务名称",name="name")
	private String name;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="mUserId")
	private Long mUserId;
	/*发送方式0：立即发送 1:定时发送**/
	@io.swagger.annotations.ApiModelProperty(value="发送方式0：立即发送 1:定时发送",name="sendType")
	private Integer sendType;
	/*券id**/
	@io.swagger.annotations.ApiModelProperty(value="券id",name="couponId")
	private Long couponId;
	/*券名称**/
	@io.swagger.annotations.ApiModelProperty(value="券名称",name="couponName")
	private String couponName;
	/*发送时间**/
	@io.swagger.annotations.ApiModelProperty(value="发送时间",name="sendTime")
	private Date sendTime;
	/*实际发送数量**/
	@io.swagger.annotations.ApiModelProperty(value="实际发送数量",name="sendAmount")
	private Integer sendAmount;
	/*0:待发送1:发送中2:已发送3:发送失败4已作废**/
	@io.swagger.annotations.ApiModelProperty(value="0:待发送1:发送中2:已发送3:发送失败4已作废",name="status")
	private Integer status;
	/*发送失败原因**/
	@io.swagger.annotations.ApiModelProperty(value="发送失败原因",name="errorMsg")
	private String errorMsg;
	/*发送人群标签**/
	@io.swagger.annotations.ApiModelProperty(value="发送人群标签",name="tags")
	private String tags;

	@io.swagger.annotations.ApiModelProperty(value="",name="modelId")
	private Long modelId;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
	private Date createTime;
	/*修改时间**/
	@io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime")
	private Date updateTime;

	@io.swagger.annotations.ApiModelProperty(value="短信id",name="msgId")
	private Long msgId;

	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public String  getName() {
		return name;
	}
	public void setName(String _name) {
		name = _name;
	}
	public Long  getMUserId() {
		return mUserId;
	}
	public void setMUserId(Long _mUserId) {
		mUserId = _mUserId;
	}
	public Integer  getSendType() {
		return sendType;
	}
	public void setSendType(Integer _sendType) {
		sendType = _sendType;
	}
	public Long  getCouponId() {
		return couponId;
	}
	public void setCouponId(Long _couponId) {
		couponId = _couponId;
	}
	public String  getCouponName() {
		return couponName;
	}
	public void setCouponName(String _couponName) {
		couponName = _couponName;
	}
	public Date  getSendTime() {
		return sendTime;
	}
	public void setSendTime(Date _sendTime) {
		sendTime = _sendTime;
	}
	public Integer  getSendAmount() {
		return sendAmount;
	}
	public void setSendAmount(Integer _sendAmount) {
		sendAmount = _sendAmount;
	}
	public Integer  getStatus() {
		return status;
	}
	public void setStatus(Integer _status) {
		status = _status;
	}
	public String  getErrorMsg() {
		return errorMsg;
	}
	public void setErrorMsg(String _errorMsg) {
		errorMsg = _errorMsg;
	}
	public String  getTags() {
		return tags;
	}
	public void setTags(String _tags) {
		tags = _tags;
	}
	public Long  getModelId() {
		return modelId;
	}
	public void setModelId(Long _modelId) {
		modelId = _modelId;
	}
	public Date  getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date _createTime) {
		createTime = _createTime;
	}
	public Date  getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date _updateTime) {
		updateTime = _updateTime;
	}

	public Date getSendTimeStart() {
		return sendTimeStart;
	}

	public void setSendTimeStart(Date sendTimeStart) {
		this.sendTimeStart = sendTimeStart;
	}

	public Date getSendTimeEnd() {
		return sendTimeEnd;
	}

	public void setSendTimeEnd(Date sendTimeEnd) {
		this.sendTimeEnd = sendTimeEnd;
	}

	public Long getmUserId() {
		return mUserId;
	}

	public void setmUserId(Long mUserId) {
		this.mUserId = mUserId;
	}

	public Long getMsgId() {
		return msgId;
	}

	public void setMsgId(Long msgId) {
		this.msgId = msgId;
	}



	@Transient
	List<WxCUserBasicInfoFilterListDto> filterList;

	public List<WxCUserBasicInfoFilterListDto> getFilterList() {
		return filterList;
	}

	public void setFilterList(List<WxCUserBasicInfoFilterListDto> filterList) {
		this.filterList = filterList;
	}

	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
		,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
		,Name_ASC("`name` ASC"),Name_DESC("`name` DESC")
		,MUserId_ASC("`m_user_id` ASC"),MUserId_DESC("`m_user_id` DESC")
		,SendType_ASC("`send_type` ASC"),SendType_DESC("`send_type` DESC")
		,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC")
		,CouponName_ASC("`coupon_name` ASC"),CouponName_DESC("`coupon_name` DESC")
		,SendTime_ASC("`send_time` ASC"),SendTime_DESC("`send_time` DESC")
		,SendAmount_ASC("`send_amount` ASC"),SendAmount_DESC("`send_amount` DESC")
		,Status_ASC("`status` ASC"),Status_DESC("`status` DESC")
		,ErrorMsg_ASC("`error_msg` ASC"),ErrorMsg_DESC("`error_msg` DESC")
		,Tags_ASC("`tags` ASC"),Tags_DESC("`tags` DESC")
		,ModelId_ASC("`model_id` ASC"),ModelId_DESC("`model_id` DESC")
		,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC")
		,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC")
		;
		private String value;
		Field(String value){
			this.value = value;
		}
		public String getValue() {
			return value;
		}
		public void setCol(String value) {
			this.value = value;
		}
		@Override
		public String toString() {
			return this.getValue();
		}
	}

	public void setSortColumns(WxCouponInject.Field... fields)
	{
		if (fields == null || fields.length == 0) {
			return;
		}
		for (int k = 0; k < fields.length; k++) {
			if (fields[k] == null) {
				return;
			}
		}
		StringBuilder sb = new StringBuilder(fields[0].toString());
		for (int k = 1; k < fields.length; k++) {
			sb.append(",");
			sb.append(fields[k].toString());
		}

		this.sortColumns = sb.toString();

	}

	public void setSortColumns(String sortColumns)
	{
		if (sortColumns == null || "".equals(sortColumns.trim())) {
			return;
		}
		if (sortColumns.contains(",")) {
			String[] cols = sortColumns.split(",");
			java.util.List<Field> fList = new java.util.ArrayList();
			for (int k = 0; k < cols.length; k++) {
				fList.add(Field.valueOf(cols[k]));
			}
			this.setSortColumns(fList.toArray(new Field[fList.size()]));
		} else {
			this.setSortColumns(Field.valueOf(sortColumns));
		}
	}
}
