package com.backendsys.entity.B2c;

import com.backendsys.entity.validator.RangeArray;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.math.BigDecimal;

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

    /**
     * b2c_goods_spec_sku
     */
    private Long id;
    @NotNull(message = "商品SKU_ID不能为空", groups = { Detail.class, Update.class, Delete.class })
    private Long good_spec_sku_id;

    // 编辑时，商品ID 不允许修改，保证数据视图显示一致性
    @NotNull(message = "商品ID不能为空", groups = { Create.class })
    private Long good_id;

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

    @NotNull(message = "商品规格金额不能为空", groups = { Create.class, Update.class })
    @Digits(integer = 9, fraction = 2, message = "商品规格金额最多支持 {integer} 位数字且小数点后最多 {fraction} 位", groups = { Create.class, Update.class })
    private BigDecimal price;

    @NotNull(message = "商品规格库存不能为空", groups = { Create.class, Update.class })
    @Min(value = 0, message = "商品规格库存必须大于等于0", groups = { Create.class, Update.class })
    @Max(value = 999999999, message = "商品规格库存必须小于等于 {max} 字符", groups = { Create.class, Update.class })
    private Long stock;

    @RangeArray(message="是否启用商品库存取值有误，范围应是(-1无限, 1有限)", value = {"-1", "1"}, groups = { Create.class, Update.class})
    private Integer is_stock;



}
