package com.czg.product.dto;

import com.alibaba.fastjson2.annotation.JSONField;
import com.czg.validator.group.DefaultGroup;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 供应商
 *
 * @author Tankaikai tankaikai@aliyun.com
 * @since 1.0 2025-02-20
 */
@Data
public class ShopVendorDTO 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;
    /**
     * 店铺Id
     */
    private Long shopId;
    /**
     * 排序
     */
    @NotNull(message = "排序值不能为空", groups = DefaultGroup.class)
    @Min(value = 1, message = "排序值不能小于1", groups = DefaultGroup.class)
    @Max(value = Integer.MAX_VALUE, message = "排序值不能大于" + Integer.MAX_VALUE, groups = DefaultGroup.class)
    private Integer sort;
    /**
     * 供应商名称
     */
    @NotBlank(message = "供应商名称不能为空", groups = DefaultGroup.class)
    private String name;
    /**
     * 联系人名字
     */
    private String contactName;
    /**
     * 联系人电话
     */
    private String telephone;
    /**
     * 结算周期（日）
     */
    private Integer period;
    /**
     * 供应商地址
     */
    private String address;
    /**
     * 标签
     */
    private String tip;
    /**
     * 备注
     */
    private String remark;
    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    /**
     * 最后一次交易时间(主要做排序)
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastTransactTime;
    /**
     * 逻辑删除 1-是 0-否
     */
    @JSONField(serialize = false)
    private Integer isDel;

}