package cn.pluss.platform.dto;

import cn.pluss.platform.constants.CommonError;
import cn.pluss.platform.entity.BankCard;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Pattern;

/**
 * @author djh
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BankCardDTO extends BankCard {

    /**
     * 到账类型 - receiptType, 目前类型与通道有做映射, 所以暂用channelType
     * D1、D0
     */
    @Pattern(regexp = "(D1)|(D0)", message = CommonError.CHANNEL_TYPE_ILLEGAL, groups = {BankCard.class})
    private String channelType;

    // public static void paramCheck(BankCardDTO bankCardDTO) {
    //     if (!Account.CHANNEL_TYPE_D1.equals(bankCardDTO.getChannelType()) && !Account.CHANNEL_TYPE_D0.equals(bankCardDTO.getChannelType())) {
    //         throw new MsgException("通道类型错误");
    //     }
    //
    //     MsgException.checkNull(bankCardDTO.getBankName(), CommonError.BANK_NAME_EMPTY);
    //
    //     MsgException.checkNull(bankCardDTO.getBranchProvince(), CommonError.BANK_BRANCH_PROVINCE_EMPTY);
    //
    //     MsgException.checkNull(bankCardDTO.getBranchCity(), CommonError.BANK_BRANCH_CITY_EMPTY);
    //
    //     MsgException.checkNull(bankCardDTO.getBranchArea(), CommonError.BANK_BRANCH_AREA_EMPTY);
    //
    //     MsgException.checkNull(bankCardDTO.getBranchName(), CommonError.BANK_BRANCH_NAME_EMPTY);
    //
    //     MsgException.checkNull(bankCardDTO.getBankCardNo(), CommonError.BANK_BRANCH_CNAPS_EMPTY);
    //
    //     MsgException.checkNull(bankCardDTO.getBankCardNo(), CommonError.BANK_BRANCH_CNAPS_EMPTY);
    // }
}
