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.time.LocalDateTime;

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

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

    /**
     * 活动ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long activityId;

    /**
     * 邀请记录ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long recordId;

    /**
     * 邀请人用户ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long inviterUserId;

    /**
     * 优惠券模板ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long couponTemplateId;

    /**
     * 奖励类型：0-邀请人 1-被邀请人
     */
    @TableField("reward_type")
    private Integer rewardType;

    /**
     * 触发类型：0-首单完成 1-邀请绑定
     */
    @TableField("trigger_type")
    private Integer triggerType;

    /**
     * 用户优惠券ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userCouponId;

    /**
     * 优惠券编码
     */
    private String couponCode;

    /**
     * 状态：0-待发放 1-已发放 2-发放失败
     */
    private Integer status;

    /**
     * 失败原因
     */
    private String failReason;

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

    /**
     * 重试次数
     */
    private Integer retryCount;

    /**
     * 操作人ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long operatorId;

    /**
     * 操作人姓名
     */
    private String operatorName;

    @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;

    @TableField(exist = false)
    private String statusLabel;

    @TableField(exist = false)
    private String couponTemplateName;

    @TableField(exist = false)
    private String inviterUserName;
}
