package com.ruoyi.ss.apiPrice.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constants.DictTypeConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.validRule.apiPriceExist.ApiPriceExist;
import com.ruoyi.system.valid.DictValid;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

/**
 * API收费标准对象 ss_api_price
 *
 * @author ruoyi
 * @date 2024-08-08
 */
@Data
public class ApiPrice extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    @ApiPriceExist(message = "API收费标准不存在", groups = {ValidGroup.Update.class})
    private Long id;

    @Excel(name = "类型")
    @ApiModelProperty("类型")
    @NotBlank(message = "类型不允许为空", groups = {ValidGroup.Create.class})
    @DictValid(type = DictTypeConstants.API_PRICE_TYPE, message = "非法的类型")
    private String type;

    @Excel(name = "标准")
    @ApiModelProperty("标准")
    @NotNull(message = "标准不允许为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "标准不允许小于0")
    private Integer num;

    @Excel(name = "标准名称")
    @ApiModelProperty("标准名称")
    @NotBlank(message = "标准名称不允许为空", groups = {ValidGroup.Create.class})
    @Size(max = 50, message = "标准名称长度不能超过50个字符")
    private String name;

    @Excel(name = "标准描述")
    @ApiModelProperty("标准描述")
    @Size(max = 200, message = "标准描述长度不能超过200个字符")
    private String description;

    @Excel(name = "价格", readConverterExp = "元=")
    @ApiModelProperty("价格")
    @NotNull(message = "价格不允许为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "价格不允许小于0")
    private BigDecimal price;

}
