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-02-02
 */
@Data
@JsonInclude
@TableName("store_order_change_log")
@ApiModel(value = "StoreOrderChangeLog对象", description = "订单变更记录表")
public class StoreOrderChangeLog {

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

    @ApiModelProperty(value = "订单ID")
    @TableField("order_id")
    private Integer orderId;

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

    @ApiModelProperty(value = "批次号（同一时间点的操作使用同一批次号，用于分组展示）")
    @TableField("batch_no")
    private String batchNo;

    @ApiModelProperty(value = "操作类型(1:首次下单, 3:更新订单)")
    @TableField("operation_type")
    private Integer operationType;

    @ApiModelProperty(value = "菜品ID")
    @TableField("cuisine_id")
    private Integer cuisineId;

    @ApiModelProperty(value = "菜品名称")
    @TableField("cuisine_name")
    private String cuisineName;

    @ApiModelProperty(value = "菜品类型(1:单品, 2:套餐)")
    @TableField("cuisine_type")
    private Integer cuisineType;

    @ApiModelProperty(value = "菜品图片")
    @TableField("cuisine_image")
    private String cuisineImage;

    @ApiModelProperty(value = "单价")
    @TableField("unit_price")
    private BigDecimal unitPrice;

    @ApiModelProperty(value = "数量变化（新增的数量，正数表示增加，负数表示减少）")
    @TableField("quantity_change")
    private Integer quantityChange;

    @ApiModelProperty(value = "变化前数量（用于展示变化前后对比）")
    @TableField("quantity_before")
    private Integer quantityBefore;

    @ApiModelProperty(value = "变化后数量（用于展示变化前后对比）")
    @TableField("quantity_after")
    private Integer quantityAfter;

    @ApiModelProperty(value = "金额变化（新增的金额）")
    @TableField("amount_change")
    private BigDecimal amountChange;

    @ApiModelProperty(value = "操作时间")
    @TableField("operation_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date operationTime;

    @ApiModelProperty(value = "操作人ID")
    @TableField("operator_user_id")
    private Integer operatorUserId;

    @ApiModelProperty(value = "操作人手机号")
    @TableField("operator_user_phone")
    private String operatorUserPhone;

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