package com.xinelu.manage.domain.coupon;

import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 优惠券信息对象 coupon
 *
 * @author xinyilu
 * @date 2023-02-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "优惠券信息对象", description = "coupon")
public class Coupon extends BaseDomain implements Serializable {
    private static final long serialVersionUID = -7531593448659387618L;
    /**
     * 主键id
     */
    @NotNull(message = "优惠券信息id不能为空", groups = {Update.class})
    private Long id;

    /**
     * 优惠券名称
     */
    @ApiModelProperty(value = "优惠券名称")
    @Excel(name = "优惠券名称")
    @NotBlank(message = "优惠券名称不能为空", groups = {Insert.class, Update.class})
    private String couponTitle;

    /**
     * 优惠券编码
     */
    @ApiModelProperty(value = "优惠券编码")
    @Excel(name = "优惠券编码")
    private String couponCode;

    /**
     * 优惠券类型，满减券：FULL_REDUCTION_COUPON，代金券：CASH_COUPON，兑换券：EXCHANGE_COUPON，折扣券：DISCOUNT_COUPON
     */
    @ApiModelProperty(value = "优惠券类型，满减券：FULL_REDUCTION_COUPON，代金券：CASH_COUPON，兑换券：EXCHANGE_COUPON，折扣券：DISCOUNT_COUPON")
    @Excel(name = "优惠券类型，满减券：FULL_REDUCTION_COUPON，代金券：CASH_COUPON，兑换券：EXCHANGE_COUPON，折扣券：DISCOUNT_COUPON")
    @NotBlank(message = "优惠券类型不能为空", groups = {Insert.class, Update.class})
    private String couponType;

    /**
     * 优惠券有效期，单位：天
     */
    @ApiModelProperty(value = "优惠券有效期，单位：天")
    @Excel(name = "优惠券有效期，单位：天")
    @NotNull(message = "优惠券有效期不能为空", groups = {Insert.class, Update.class})
    private Integer couponReductionDays;

    /**
     * 优惠券面额
     */
    @ApiModelProperty(value = "优惠券面额")
    @Excel(name = "优惠券面额")
    @NotNull(message = "优惠券面额不能为空", groups = {Update.class})
    private BigDecimal couponPrice;

    /**
     * 优惠券适用门槛
     */
    @ApiModelProperty(value = "优惠券适用门槛")
    @Excel(name = "优惠券适用门槛")
    @NotNull(message = "优惠券适用门槛不能为空", groups = {Insert.class, Update.class})
    private BigDecimal couponConsumePrice;

    /**
     * 优惠券概述，包括使用范围，使用注意事项等信息
     */
    @ApiModelProperty(value = "优惠券概述，包括使用范围，使用注意事项等信息")
    @Excel(name = "优惠券概述，包括使用范围，使用注意事项等信息")
    @NotBlank(message = "优惠券概述不能为空", groups = {Insert.class, Update.class})
    private String couponDescription;

    /**
     * 领取方式，新人福利：NEW_PEOPLE_WELFARE，活动赠送：EVENT_GIFT，消费返券：CONSUME_REBATE
     */
    @ApiModelProperty(value = "领取方式，新人福利：NEW_PEOPLE_WELFARE，活动赠送：EVENT_GIFT，消费返券：CONSUME_REBATE")
    @Excel(name = "领取方式，新人福利：NEW_PEOPLE_WELFARE，活动赠送：EVENT_GIFT，消费返券：CONSUME_REBATE")
    @NotBlank(message = "优惠券领取方式不能为空", groups = {Insert.class, Update.class})
    private String receiveType;

    /**
     * 发放数量
     */
    @ApiModelProperty(value = "发放数量")
    @Excel(name = "发放数量")
    private Integer receiveCount;

    /**
     * 发放数量上限
     */
    @ApiModelProperty(value = "发放数量上限")
    @Excel(name = "发放数量上限")
    private Integer receiveLimitCount;

    /**
     * 全部商品：ALL_PRODUCT，指定商品：SPECIFIED_COMMODITY
     */
    @ApiModelProperty(value = "全部商品：ALL_PRODUCT，指定商品：SPECIFIED_COMMODITY")
    @Excel(name = "全部商品：ALL_PRODUCT，指定商品：SPECIFIED_COMMODITY")
    private String useScope;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    @Excel(name = "显示顺序")
    @NotNull(message = "显示顺序不能为空！", groups = {Insert.class, Update.class})
    @Size(max = 5, message = "显示顺序不能超过5个字符")
    private Integer showSort;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("couponTitle", getCouponTitle())
                .append("couponCode", getCouponCode())
                .append("couponType", getCouponType())
                .append("couponReductionDays", getCouponReductionDays())
                .append("couponPrice", getCouponPrice())
                .append("couponConsumePrice", getCouponConsumePrice())
                .append("couponDescription", getCouponDescription())
                .append("receiveType", getReceiveType())
                .append("receiveCount", getReceiveCount())
                .append("receiveLimitCount", getReceiveLimitCount())
                .append("useScope", getUseScope())
                .append("showSort", getShowSort())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
