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.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_product")
public class Product implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 哈哈平台商品ID
     */
    private String productId;

    /**
     * 商品编码（哈哈平台code）
     */
    private String code;

    /**
     * 关联的ERP商品ID（ERP内部goodsId）
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long erpGoodsId;

    /**
     * 商品条码
     */
    private String barcode;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 商品分类（如：饮料、零食等）
     */
    private String type;

    /**
     * 商品图片URL
     */
    private String pic;

    /**
     * 商品陈列图URL
     */
    private String planogram;

    /**
     * 适用设备：全部柜、静态柜、动态柜
     */
    private String applyStatus;

    /**
     * 成本价
     */
    private Double costPrice;

    /**
     * 零售价（门店统一售价）
     */
    private Double retailPrice;

    /**
     * 商家自定义商品ID
     */
    private String customerId;

    /**
     * 同步状态：0-未同步，1-同步中，2-已同步，3-同步失败
     */
    private Integer syncStatus;

    /**
     * 最后同步时间
     */
    private LocalDateTime syncTime;

    /**
     * 是否删除：0-正常，1-已删除
     */
    private Integer isDeleted;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    // ========== 以下为非数据库字段，用于前端展示 ==========

    @TableField(exist = false)
    private String category;

    @TableField(exist = false)
    private String imageUrl;

    @TableField(exist = false)
    private Double price;

    @TableField(exist = false)
    private Double cost;

    @TableField(exist = false)
    private String syncStatusLabel;

    @TableField(exist = false)
    private String syncStatusColor;

    @TableField(exist = false)
    private String hahaModelId;

    @TableField(exist = false)
    private String specification;

    @TableField(exist = false)
    private String supplier;

    @TableField(exist = false)
    private String shelfLife;

    @TableField(exist = false)
    private String storageConditions;

    @TableField(exist = false)
    private String description;

    @TableField(exist = false)
    private LocalDateTime lastSyncTime;

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