package com.czg.product.dto;

import com.alibaba.fastjson2.annotation.JSONField;
import com.czg.validator.group.DefaultGroup;
import com.czg.validator.group.Group;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

/**
* 商品分组
*
* @author Tankaikai tankaikai@aliyun.com
* @since 1.0 2025-02-17
*/
@Data
public class ProdGroupDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Null(message = "ID必须为空", groups = InsertGroup.class)
    @NotNull(message = "ID不能为空", groups = UpdateGroup.class)
    private Long id;
    /**
     * 分组名称
     */
    @NotBlank(message = "分组名称不能为空", groups = DefaultGroup.class)
    private String name;
    /**
     * 店铺Id
     */
    private Long shopId;
    /**
     * 图标
     */
    private String pic;
    /**
     * 状态 0-禁用 1-启用
     */
    @NotNull(message = "状态不能为空", groups = Group.class)
    private Integer status;
    /**
     * 排序
     */
    @NotNull(message = "排序值不能为空", groups = DefaultGroup.class)
    @Min(value = 0, message = "排序值不能小于0", groups = DefaultGroup.class)
    private Integer sort;
    /**
     * 排序方式 0-默认; 1-价格从高到低; 2-销量由高到低;
     */
    @NotNull(message = "排序方式不能为空", groups = Group.class)
    private String sortMode;
    /**
     * 开启时间管控 0:否；1:是
     */
    @NotNull(message = "售卖时间管控不能为空", groups = Group.class)
    private Integer useTime;
    /**
     * 售卖开始时间
     */
    @JSONField(format = "HH:mm:ss")
    private LocalTime saleStartTime;
    /**
     * 售卖结束时间
     */
    @JSONField(format = "HH:mm:ss")
    private LocalTime saleEndTime;
    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 商品ID数组
     */
    private Long[] productIds;

    /**
     * 商品简要信息列表
     */
    private List<ProductBriefDTO> productList;
}