package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 优惠券使用记录表
 *
 * @author system
 * @since 2025-01-XX
 */
@Data
@JsonInclude
@TableName("store_coupon_usage")
@ApiModel(value = "StoreCouponUsage对象", description = "优惠券使用记录表")
public class StoreCouponUsage {

    @ApiModelProperty(value = "主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "桌号ID")
    @TableField("table_id")
    private Integer tableId;

    @ApiModelProperty(value = "门店ID")
    @TableField("store_id")
    private Integer storeId;

    @ApiModelProperty(value = "订单ID（下单时关联）")
    @TableField("order_id")
    private Integer orderId;

    @ApiModelProperty(value = "优惠券ID")
    @TableField("coupon_id")
    private Integer couponId;

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

    @ApiModelProperty(value = "优惠金额")
    @TableField("discount_amount")
    private BigDecimal discountAmount;

    @ApiModelProperty(value = "使用状态(0:已标记使用, 1:已下单, 2:已支付, 3:已取消)")
    @TableField("usage_status")
    private Integer usageStatus;

    @ApiModelProperty(value = "换桌前的桌号ID（如果是换桌迁移）")
    @TableField("from_table_id")
    private Integer fromTableId;

    @ApiModelProperty(value = "换桌迁移时间")
    @TableField("migrate_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date migrateTime;

    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @ApiModelProperty(value = "创建人ID")
    @TableField("created_user_id")
    private Integer createdUserId;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty(value = "修改人ID")
    @TableField("updated_user_id")
    private Integer updatedUserId;
}
