package com.gxwebsoft.cms.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * 产品
 *
 * @author WorkBuddy
 * @since 2026-07-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("cms_product")
@Schema(name = "CmsProduct对象", description = "产品")
public class CmsProduct implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "产品ID")
    @TableId(value = "product_id", type = IdType.AUTO)
    private Integer productId;

    @Schema(description = "产品名称")
    private String productName;

    @Schema(description = "封面图")
    private String cover;

    @Schema(description = "简介")
    private String summary;

    @Schema(description = "详情描述")
    private String description;

    @Schema(description = "分类ID")
    private Integer categoryId;

    @Schema(description = "分类名称(冗余存储)")
    private String categoryName;

    @Schema(description = "价格")
    private BigDecimal price;

    @Schema(description = "原价")
    private BigDecimal originalPrice;

    @Schema(description = "计价单位")
    private String unit;

    @Schema(description = "计费方式: 1包月 2包年 3一次性 4按量")
    private Integer chargeType;

    @Schema(description = "状态: 1在售 0下架")
    private Integer status;

    @Schema(description = "排序(数字越小越靠前)")
    @JsonProperty("sortNum")
    @JSONField(name = "sortNum")
    private Integer sortNumber;

    @Schema(description = "是否置顶: 1置顶 0否")
    private Integer top;

    @Schema(description = "标签, 逗号分隔")
    private String tags;

    @Schema(description = "创建人ID")
    private Integer userId;

    @Schema(description = "是否删除: 0否 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
