package com.haha.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName("t_coupon_template")
public class CouponTemplate implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    private String couponName;

    private Integer couponType;

    private String couponDesc;

    private BigDecimal discountValue;

    private BigDecimal minAmount;

    private BigDecimal maxDiscount;

    private Integer totalCount;

    private Integer remainCount;

    private Integer receiveLimit;

    private Integer validType;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime validStartTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime validEndTime;

    private Integer validDays;

    private Integer applyScope;

    private Integer productScope;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long activityId;

    private Integer status;

    private String receiveType; // 发放类型：Collect-主动领取，Release-系统发放

    @JsonSerialize(using = ToStringSerializer.class)
    private Long creatorId;

    private String creatorName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime updateTime;

    private Integer deleted;

    @TableField(exist = false)
    private String typeLabel;

    @TableField(exist = false)
    private String validTypeLabel;

    @TableField(exist = false)
    private String statusLabel;

    @TableField(exist = false)
    private String statusColor;

    @TableField(exist = false)
    private Boolean alreadyReceived;
}
