package com.gxwebsoft.cms.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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;
import java.util.List;

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

    @Schema(description = "轮播组ID")
    @TableId(value = "group_id", type = IdType.AUTO)
    private Integer groupId;

    @Schema(description = "组标题(如:首页幻灯片)")
    private String title;

    @Schema(description = "展示位置标识(home_slider/home_promo/inner_page等)")
    private String position;

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

    /**
     * 组内轮播项(非数据库字段)
     * 列表/详情查询时返回
     */
    @Schema(description = "组内轮播项")
    @TableField(exist = false)
    private List<CmsBannerItem> items;
}
