package shop.alien.entity.store.vo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import shop.alien.entity.store.LifeDiscountCouponFriendRule;

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

/**
 * 赠券规则
 * @TableName life_discount_coupon_friend_rule
 */
@TableName(value ="life_discount_coupon_friend_rule")
@JsonInclude
@Data
public class LifeDiscountCouponFriendRuleVo extends LifeDiscountCouponFriendRule {

    @JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8")
    @ApiModelProperty(value = "截止时间")
    private Date endDate;

    @ApiModelProperty(value = "店铺名称")
    private String storeName;

    @ApiModelProperty(value = "0启用/1禁用")
    private String status;

    @ApiModelProperty(value = "img")
    private String imgUrl;

    /**
     * 列表展示「对方」商户的 store_user.id（我收到=赠送方，我送出=接收方），用于精准匹配 head_img；
     * 非库表字段，仅为接口拼装，不序列化到 JSON。
     */
    @JsonIgnore
    @TableField(exist = false)
    @ApiModelProperty(hidden = true, value = "对方商户用户ID（store_user.id），内部用于头像")
    private Integer counterpartyStoreUserId;

    @ApiModelProperty(value = "优惠券名称")
    private String couponName;

    @ApiModelProperty(value = "优惠券数量")
    private Integer couponNum;

    @ApiModelProperty(value = "优惠券id")
    private Integer couponId;

    @ApiModelProperty(value = "代金券id，type=4 时有值")
    private String voucherId;

    @ApiModelProperty(value = "类型：1=优惠券，4=代金券")
    private Integer type;

    @ApiModelProperty(value = "面值")
    private BigDecimal nominalValue;

    @ApiModelProperty(value = "最低消费")
    private BigDecimal minimumSpendingAmount;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "有效期（优惠券/代金券的结束日期）")
    private Date validDate;

    @ApiModelProperty(value = "优惠券类型：1-满减券，2-折扣券（仅优惠券有值，代金券为null）")
    private Integer couponType;

    @ApiModelProperty(value = "折扣率（0-100，用于折扣券，例如80表示8折，仅折扣券有值）")
    private BigDecimal discountRate;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "开始领取时间（仅优惠券有值，代金券为null）")
    private Date beginGetDate;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "结束领取时间（仅优惠券有值，代金券为null）")
    private Date endGetDate;

    @TableField(exist = false)
    @ApiModelProperty(value = "领取后有效期天数，对应优惠券表 life_discount_coupon.expiration_date")
    private Integer expirationDate;

    @TableField(exist = false)
    @ApiModelProperty(value = "领取后是否长期有效：0-否，1-是（无时间上限；优先 ldcsf 快照，COALESCE 模板 long_term_valid）")
    private Integer longTermValid;

    private List<LifeDiscountCouponFriendRuleDetailVo> lifeDiscountCouponFriendRuleDetailVos;
}