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.time.LocalDateTime;

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

    @Schema(description = "轮播图ID")
    @TableId(value = "banner_id", type = IdType.AUTO)
    private Integer bannerId;

    @Schema(description = "标题")
    private String title;

    @Schema(description = "图片地址")
    private String image;

    @Schema(description = "跳转类型: 0无 1外链 2文章 3产品")
    private Integer linkType;

    @Schema(description = "外链地址")
    private String linkUrl;

    @Schema(description = "跳转目标ID(文章/产品)")
    private Integer linkTargetId;

    @Schema(description = "状态: 1启用 0停用")
    private Integer status;

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

    @Schema(description = "生效开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    @Schema(description = "生效结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    @Schema(description = "备注")
    private String remark;

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