package com.snack.server.module.cart.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
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 lombok.Data;

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

/**
 * 购物车
 *
 * 对应数据库表：cart
 * 唯一约束：(user_id, sku_id)
 */
@Data
@TableName("cart")
public class Cart implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /** 用户 ID */
    private Long userId;

    /** 商品 SPU ID */
    private Long productId;

    /** 商品 SKU ID */
    private Long skuId;

    /** 数量 */
    private Integer quantity;

    /** 选中状态：0-未选 1-已选 */
    private Integer selected;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
