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_order")
@ApiModel(value = "StoreOrder对象", description = "订单表")
public class StoreOrder {

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

    @ApiModelProperty(value = "订单号")
    @TableField("order_no")
    private String orderNo;

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

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

    @ApiModelProperty(value = "桌号")
    @TableField("table_number")
    private String tableNumber;

    @ApiModelProperty(value = "就餐人数")
    @TableField("diner_count")
    private Integer dinerCount;

    @ApiModelProperty(value = "支付用户ID")
    @TableField("pay_user_id")
    private Integer payUserId;

    @ApiModelProperty(value = "支付用户手机号")
    @TableField("pay_user_phone")
    private String payUserPhone;

    @ApiModelProperty(value = "联系电话")
    @TableField("contact_phone")
    private String contactPhone;

    @ApiModelProperty(value = "餐具费")
    @TableField("tableware_fee")
    private BigDecimal tablewareFee;

    @ApiModelProperty(value = "订单状态(0:待支付, 1:已支付, 2:已取消, 3:已完成)")
    @TableField("order_status")
    private Integer orderStatus;

    @ApiModelProperty(value = "订单总金额")
    @TableField("total_amount")
    private BigDecimal totalAmount;

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

    @ApiModelProperty(value = "当前使用的优惠券ID（用于换桌场景）")
    @TableField("current_coupon_id")
    private Integer currentCouponId;

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

    @ApiModelProperty(value = "锁定用户ID（下单或结算时锁定）")
    @TableField("lock_user_id")
    private Integer lockUserId;

    @ApiModelProperty(value = "锁定过期时间")
    @TableField("lock_expire_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lockExpireTime;

    @ApiModelProperty(value = "实付金额")
    @TableField("pay_amount")
    private BigDecimal payAmount;

    @ApiModelProperty(value = "支付方式(1:微信, 2:支付宝, 3:现金)")
    @TableField("pay_type")
    private Integer payType;

    @ApiModelProperty(value = "支付状态(0:未支付, 1:已支付, 2:已退款)")
    @TableField("pay_status")
    private Integer payStatus;

    @ApiModelProperty(value = "支付时间")
    @TableField("pay_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payTime;

    @ApiModelProperty(value = "支付交易号")
    @TableField("pay_trade_no")
    private String payTradeNo;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

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