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

import com.cf.imes.framework.common.validation.NumberValid;
import com.cf.imes.module.system.validation.products.ProductType;
import com.cf.imes.module.system.validation.products.TimeUnitValid;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
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 = "产品名称不能为空")
    private Long productId;

    @Schema(description = "购买方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
    @NotNull(message = "购买方式不能为空")
    @ProductType
    private Integer purchaseType;

    @Schema(description = "产品时间，格式：时长值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private String duration;

    @Schema(description = "产品时长单位，0：年、1：月、2：日", example = "1")
    @TimeUnitValid
    private Integer durationUnit;

    @Schema(description = "产品产量", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
    private BigDecimal output;
//
    @Schema(description = "赠送时间，格式：时长值 - 时间单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private String giftDuration;

    @Schema(description = "赠送时长单位，0：年、1：月、2：日", example = "1")
    @TimeUnitValid
    private Integer giftDurationUnit;

    @Schema(description = "赠送产量", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
    private BigDecimal giftOutput;

    @Schema(description = "产品原价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
    @NotNull(message = "产品原价不能为空")
    @NumberValid(name = "产品原价")
    private BigDecimal originalPrice;

    @Schema(description = "折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "0.8")
    @DecimalMax(value = "100", inclusive = false, message = "折扣必须小于100")
    @DecimalMin(value = "0", inclusive = false, message = "折扣必须大于0")
    private BigDecimal discount;

    @Schema(description = "产品现价", requiredMode = Schema.RequiredMode.REQUIRED, example = "80")
    @NotNull(message = "产品现价不能为空")
    @NumberValid(name = "产品现价")
    private BigDecimal currentPrice;

    @Schema(description = "是否特惠", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    private Boolean isDiscounted;

}
