package com.cyksj.model.views;

import com.cyksj.model.entity.Coupon;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;

/*
 *项目名: netflix
 *文件名: CouponTfPopularizeView
 *创建者: JavaZou
 *创建时间:2023/7/7 15:15
 */
@Getter
@Setter
@SearchBean(tables = "coupon c left join coupon_user cu on cu.coupon_id = c.id :user_id:")
public class CouponTfPopularizeView {

	/**
	 * 优惠券id
	 */
	@DbField("c.id")
	private Long couponId;

	/**
	 * 优惠券名称
	 */
	@DbField("c.name")
	private String name;

	/**
	 * 优惠券平台类型
	 */
	@DbField("c.goods_type")
	private Coupon.GoodsType goodsType;

	/**
	 * 优惠券类型
	 */
	@DbField("c.type")
	private Coupon.Type type;

	/**
	 * 可用满减卷金额条件
	 */
	@DbField("c.reduce_condition")
	private BigDecimal reduceCondition;

	/**
	 * 抵扣金额
	 */
	@DbField("c.reduce_money")
	private BigDecimal reduceMoney;

	/**
	 * 折扣
	 */
	@DbField("c.discount")
	private BigDecimal discount;

	/**
	 * 领取人范围
	 */
	@DbField("c.scope")
	private Coupon.Scope scope;

	/**
	 * 平台规格集合
	 */
	@DbField("c.goods_sku_ids")
	private String goodsSkuIds;

	@DbIgnore
	private String goodsSkuStr;

	/**
	 * 是否是有效时间
	 */
	@DbField("c.is_valid_time")
	private Boolean isValidTime;

	/**
	 * 起始有效时间
	 */
	@DbField("c.valid_start_time")
	private Date validStartTime;

	/**
	 * 截止有效时间
	 */
	@DbField("c.valid_end_time")
	private Date validEndTime;

	/**
	 * 领取有效天数
	 */
	@DbField("c.valid_days")
	private Integer validDays;

	/**
	 * 使用范围
	 */
	@DbField("c.use_scope")
	private Coupon.UseScope useScope;

	@DbField("case when cu.id is not null then 'received' else 'collecting' end")
	private CouponActiveView.CouponStatus couponStatus;
}
