package com.cf.imes.module.system.controller.admin.funds.products.vo.productDetails;

import com.cf.imes.module.system.validation.products.ProductDurationUnitValid;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.Min;
import lombok.Data;

import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;

@Schema(description = "管理后台 - 产品明细表 productDetails新增/修改 Request VO")
@Data
public class ProductDetailsSaveReqVO {

    @Schema(description = "产品详情id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10725")
    private Long id;

    @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "{product.detail.save.productId.notNull}")
    private Long productId;

    @Schema(description = "产品时长，格式：时长值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @Min(value = 1, message = "{product.detail.save.duration.min}")
    @NotNull(message = "{product.detail.duration.notNull}")
    private Integer duration;

    @Schema(description = "产品时长单位，0：年", example = "1")
    @ProductDurationUnitValid
    @NotNull(message = "{product.detail.duration.unit.notNull}")
    private Integer durationUnit;

    @Schema(description = "折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "0.8")
    @DecimalMax(value = "100", message = "{product.detail.save.discount.max}")
    @DecimalMin(value = "0", message = "{product.detail.save.discount.min}")
    @Digits(integer = 3, fraction = 0, message = "{product.detail.save.discount.format}")
    @NotNull(message = "{product.detail.save.discount.notNull}")
    private BigDecimal discount;

}
