package com.ruoyi.bst.channel.domain;

import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constants.DictType;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.common.domain.JsonViewProfile;
import com.ruoyi.common.valid.DictValid;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.List;

/**
 * 充值渠道对象 sm_channel
 *
 * @author ruoyi
 * @date 2024-04-15
 */
@Data
public class Channel extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    @JsonView(JsonViewProfile.App.class)
    private Long channelId;

    /** 渠道名称 */
    @Excel(name = "渠道名称")
    @JsonView(JsonViewProfile.App.class)
    private String name;

    /** 是否启用 */
    @Excel(name = "是否启用")
    private Boolean enabled;

    /** 成本率% */
    @Excel(name = "成本率%")
    @Min(value = 0, message = "成本率不允许低于0", groups = {ValidGroup.Update.class})
    private BigDecimal costRate;

    @ApiModelProperty("渠道图片")
    @JsonView(JsonViewProfile.App.class)
    private String picture;

    @Excel(name = "渠道API类型", readConverterExp = "1=微信支付,2=支付宝,3=银行卡,4=通联微信,5=太米微信")
    @ApiModelProperty("渠道API类型")
    @NotBlank(message = "渠道API类型不能为空", groups = {ValidGroup.Create.class})
    private String apiType;

    @Excel(name = "渠道类型", dictType = DictType.CHANNEL_TYPE)
    @ApiModelProperty("渠道类型")
    @NotBlank(message = "渠道类型不能为空", groups = {ValidGroup.Create.class})
    @DictValid(type = DictType.CHANNEL_TYPE, message = "非法的支付渠道类型")
    private String type;

    @Excel(name = "渠道配置")
    @ApiModelProperty("渠道配置")
    private ChannelConfig channelConfig;

    @Excel(name = "应用的appId列表")
    @ApiModelProperty("应用的appId列表")
    private List<Long> appIds;
}
