package com.backendsys.entity.B2c;

import jakarta.validation.constraints.*;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class B2cOrderSnapshootGoodDTO {
    public static interface Detail{}
    public static interface Create{}
    public static interface Update{}
    public static interface Delete{}

    /**
     * b2c_order_snapshoot_good
     */
    private Long id;
    @NotNull(message = "订单快照不能为空", groups = { B2cOrderSnapshootGoodDTO.Detail.class, B2cOrderSnapshootGoodDTO.Update.class, B2cOrderSnapshootGoodDTO.Delete.class })
    private Long order_snapshoot_good_id;

    @NotNull(message = "订单ID不能为空", groups = { B2cOrderSnapshootGoodDTO.Detail.class, B2cOrderSnapshootGoodDTO.Update.class, B2cOrderSnapshootGoodDTO.Delete.class })
    private Long order_id;

    @NotBlank(message = "商品名称不能为空", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    private String good_name;

    @NotBlank(message = "商品描述不能为空", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    private String good_description;
    
    private String good_thumb;

    @NotBlank(message = "规格ID集合不能为空", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    private String spec_ids;

    @NotBlank(message = "规格集合不能为空", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    private String spec_groups;

    @NotNull(message = "单价不能为空", groups = { B2cOrderSnapshootGoodDTO.Detail.class, B2cOrderSnapshootGoodDTO.Update.class, B2cOrderSnapshootGoodDTO.Delete.class })
    @Digits(integer = 9, fraction = 2, message = "单价最多支持 {integer} 位数字且小数点后最多 {fraction} 位", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    private BigDecimal unit_price;

    @NotNull(message = "购买数量不能为空", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    @Min(value = 0, message = "购买数量必须大于等于0", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    @Max(value = 999999999, message = "购买数量必须小于等于 {max} 字符", groups = { B2cOrderSnapshootGoodDTO.Create.class, B2cOrderSnapshootGoodDTO.Update.class })
    private Long quantity;
}
