package com.iformall.domain.po;

import com.iformall.domain.vo.WxCouponChannelVo;

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_campaign")
public class WxCampaign implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	protected Long id;

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

	public List<WxCouponChannelVo> getCoupons() {
		return coupons;
	}

	public void setCoupons(List<WxCouponChannelVo> coupons) {
		this.coupons = coupons;
	}

	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="coverImg")
	private String coverImg;
	/*主标题**/
	@io.swagger.annotations.ApiModelProperty(value="主标题",name="title")
	private String title;
	/*副标题**/
	@io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle")
	private String subTitle;
	/*满x可用**/
	@io.swagger.annotations.ApiModelProperty(value="满x可用",name="usePrice")
	private Integer usePrice;
	/*折扣**/
	@io.swagger.annotations.ApiModelProperty(value="折扣",name="discountPrice")
	private Integer discountPrice;
	/*活动说明**/
	@io.swagger.annotations.ApiModelProperty(value="活动说明",name="detail")
	private String detail;
	/*有效日期-开始**/
	@io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate")
	private Date validStartDate;
	/*有效日期-结束**/
	@io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate")
	private Date validEndDate;
	/*图文详情**/
	@io.swagger.annotations.ApiModelProperty(value="图文详情",name="imgDetail")
	private String imgDetail;
	/*类型：0：促销 1：宣传页**/
	@io.swagger.annotations.ApiModelProperty(value="类型：0：促销 1：宣传页",name="type")
	private Integer type;
	/*优惠券ids**/
	@io.swagger.annotations.ApiModelProperty(value="优惠券ids",name="couponIds")
	private String couponIds;
	/*门店id**/
	@io.swagger.annotations.ApiModelProperty(value="门店id",name="mechantId")
	private Long mechantId;
	/*排序**/
	@io.swagger.annotations.ApiModelProperty(value="排序",name="sortNum")
	private Integer sortNum;
	/*0上线 1下线**/
	@io.swagger.annotations.ApiModelProperty(value="0上线 1下线",name="status")
	private Integer status;
	/***/
	@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="富文本",name="html")
	private String html;

    public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public String  getCoverImg() {
		return coverImg;
	}
	public void setCoverImg(String _coverImg) {
		coverImg = _coverImg;
	}
	public String  getTitle() {
		return title;
	}
	public void setTitle(String _title) {
		title = _title;
	}
	public String  getSubTitle() {
		return subTitle;
	}
	public void setSubTitle(String _subTitle) {
		subTitle = _subTitle;
	}
	public Integer  getUsePrice() {
		return usePrice;
	}
	public void setUsePrice(Integer _usePrice) {
		usePrice = _usePrice;
	}
	public Integer  getDiscountPrice() {
		return discountPrice;
	}
	public void setDiscountPrice(Integer _discountPrice) {
		discountPrice = _discountPrice;
	}
	public String  getDetail() {
		return detail;
	}
	public void setDetail(String _detail) {
		detail = _detail;
	}
	public Date  getValidStartDate() {
		return validStartDate;
	}
	public void setValidStartDate(Date _validStartDate) {
		validStartDate = _validStartDate;
	}
	public Date  getValidEndDate() {
		return validEndDate;
	}
	public void setValidEndDate(Date _validEndDate) {
		validEndDate = _validEndDate;
	}
	public String  getImgDetail() {
		return imgDetail;
	}
	public void setImgDetail(String _imgDetail) {
		imgDetail = _imgDetail;
	}
	public Integer  getType() {
		return type;
	}
	public void setType(Integer _type) {
		type = _type;
	}
	public String  getCouponIds() {
		return couponIds;
	}
	public void setCouponIds(String _couponIds) {
		couponIds = _couponIds;
	}
	public Long  getMechantId() {
		return mechantId;
	}
	public void setMechantId(Long _mechantId) {
		mechantId = _mechantId;
	}
	public Integer  getSortNum() {
		return sortNum;
	}
	public void setSortNum(Integer _sortNum) {
		sortNum = _sortNum;
	}
	public Integer  getStatus() {
		return status;
	}
	public void setStatus(Integer _status) {
		status = _status;
	}
	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 String getHtml() {
		return html;
	}

	public void setHtml(String html) {
		this.html = html;
	}

	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
		,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
		,CoverImg_ASC("`cover_img` ASC"),CoverImg_DESC("`cover_img` DESC")
		,Title_ASC("`title` ASC"),Title_DESC("`title` DESC")
		,SubTitle_ASC("`sub_title` ASC"),SubTitle_DESC("`sub_title` DESC")
		,UsePrice_ASC("`use_price` ASC"),UsePrice_DESC("`use_price` DESC")
		,DiscountPrice_ASC("`discount_price` ASC"),DiscountPrice_DESC("`discount_price` DESC")
		,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC")
		,ValidStartDate_ASC("`valid_start_date` ASC"),ValidStartDate_DESC("`valid_start_date` DESC")
		,ValidEndDate_ASC("`valid_end_date` ASC"),ValidEndDate_DESC("`valid_end_date` DESC")
		,ImgDetail_ASC("`img_detail` ASC"),ImgDetail_DESC("`img_detail` DESC")
		,Type_ASC("`type` ASC"),Type_DESC("`type` DESC")
		,CouponIds_ASC("`coupon_ids` ASC"),CouponIds_DESC("`coupon_ids` DESC")
		,MechantId_ASC("`mechant_id` ASC"),MechantId_DESC("`mechantId` DESC")
		,SortNum_ASC("`sort_num` ASC"),SortNum_DESC("`sortNum` DESC")
		,Status_ASC("`status` ASC"),Status_DESC("`status` 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(WxCampaign.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));
		}
	}
}
