package com.fzm.mall.server.admin.finance_center.entity.dto;

import com.fzm.mall.server.admin.annotation.CustomType;
import com.fzm.mall.server.admin.constant.MALLGlobalConfig;
import com.fzm.mall.server.admin.constant.MallResponseError;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * @author wangp
 * @date 2021/4/27 17:15
 * @description 积分转账
 * @since JDK 1.8
 */
@Data
@ApiModel(value = "TransferAccountsDTO", description = "积分转账")
public class TransferAccountsDTO {
    @ApiModelProperty("转账手机号")
    @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
    private String phone;

    @ApiModelProperty("转账数量")
    @DecimalMin(value = "0", message = MallResponseError.VALUE_LT_0_ERROR)
    @NotNull(message = MallResponseError.NULL_PARAM_ERROR)
    private BigDecimal amount;

    @ApiModelProperty("转账对象(1.商户 2.用户)")
    @CustomType(pType = MALLGlobalConfig.TRAN_OBJECT, message = MallResponseError.PARAM_ERROR)
    @NotNull(message = MallResponseError.NULL_PARAM_ERROR)
    private Integer type;

    public TransferAccountsDTO() {
    }

    public TransferAccountsDTO(@NotBlank(message = MallResponseError.NULL_PARAM_ERROR) String phone, @DecimalMin(value = "0", message = MallResponseError.VALUE_LT_0_ERROR) @NotNull(message = MallResponseError.NULL_PARAM_ERROR) BigDecimal amount) {
        this.phone = phone;
        this.amount = amount;
    }

    public TransferAccountsDTO(@NotBlank(message = MallResponseError.NULL_PARAM_ERROR) String phone, @DecimalMin(value = "0", message = MallResponseError.VALUE_LT_0_ERROR) @NotNull(message = MallResponseError.NULL_PARAM_ERROR) BigDecimal amount, @NotNull(message = MallResponseError.NULL_PARAM_ERROR) Integer type) {
        this.phone = phone;
        this.amount = amount;
        this.type = type;
    }
}
