package com.ylx.giftCard.domain.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

@Data
@ApiModel("购物卡管理新增DTO")
public class GiftCardManageSaveDTO implements Serializable {
    private static final long serialVersionUID = -3120530382569245494L;

    /**
     * 商户ID
     */
    @ApiModelProperty("商户ID")
    private String merchantId;

    /**
     * 购物卡名称
     */
    @NotBlank(message = "购物卡名称不能为空")
    @Size(max = 20, message = "购物卡名称不能超过20个字符")
    @ApiModelProperty(value = "购物卡名称", required = true)
    private String name;

    /**
     * 缩略图URL（上传后存储路径）
     */
    @NotBlank(message = "图片不能为空")
    @ApiModelProperty(value = "图片URL", required = true)
    private String imageUrl;

    /**
     * 购物卡金额
     */
    @NotNull(message = "购物卡金额不能为空")
    @DecimalMin(value = "0.01", message = "购物卡金额必须大于0")
    @ApiModelProperty(value = "购物卡金额", required = true)
    private BigDecimal amount;

    /**
     * 商户提成比例
     */
    @NotNull(message = "商户提成比例不能为空")
    @DecimalMin(value = "0", message = "商户提成比例不能小于0")
    @DecimalMax(value = "100", message = "商户提成比例不能大于100")
    @ApiModelProperty(value = "商户提成比例", required = true)
    private BigDecimal commissionRate;

    /**
     * 库存
     */
    @NotNull(message = "库存不能为空")
    @Min(value = 0, message = "库存不能小于0")
    @ApiModelProperty(value = "库存", required = true)
    private Integer stock;

    /**
     * 有效期开始日期
     */
    @NotNull(message = "有效期开始日期不能为空")
    @ApiModelProperty(value = "有效期开始日期", required = true)
    private LocalDate validStartDate;

    /**
     * 有效期结束日期
     */
    @NotNull(message = "有效期结束日期不能为空")
    @ApiModelProperty(value = "有效期结束日期", required = true)
    private LocalDate validEndDate;

    /**
     * 是否上架：1=上架，0=下架，不传默认下架
     */
    @ApiModelProperty("是否上架：1=上架，0=下架，不传默认下架")
    private Integer isPublished;

    /**
     * 详情
     */
    @ApiModelProperty("详情")
    private String description;
}
