package cn.pluss.platform.vo;

import java.util.List;

import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.entity.MerchantImage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author yuchen
 *
 * @Description
 */
@Data
public class BusinessLicenseVO {

    @ApiModelProperty(value = "营业执照号码")
    private String bussAuthNum;

    @ApiModelProperty(value = "营业执照名称/商户名称")
    private String bussAuthName;

    @ApiModelProperty(value = "营业执照上的名字")
    private String principalPerson;

    @ApiModelProperty(value = "营业执照上的地址/注册地址")
    private String bussAuthAddress;

    @ApiModelProperty(value = "营业执照注册开始时间")
    private String bussAuthStartTime;

    @ApiModelProperty(value = "营业执照有效期结束时间")
    private String bussAuthEndTime;

    @ApiModelProperty(value = "营业执照地址")
    private String businessLicensePic;

    private String type;

    private String typeCode;

    private String typeDesc;


    public static BusinessLicenseVO convertMerchantBaseInfo(MerchantBaseInfo merchantBaseInfo, List<MerchantImage> list) {
        BusinessLicenseVO vo = new BusinessLicenseVO();
        vo.setBussAuthAddress(merchantBaseInfo.getBussAuthAddress());
        vo.setBussAuthStartTime(merchantBaseInfo.getBussAuthStartTime());
        vo.setBussAuthEndTime(merchantBaseInfo.getBussAuthEndTime());
        vo.setBussAuthNum(merchantBaseInfo.getBussAuthNum());
        vo.setBussAuthName(merchantBaseInfo.getBussAuthName());
        vo.setPrincipalPerson(merchantBaseInfo.getPrincipalPerson());
        vo.setType(merchantBaseInfo.getBuslicType());
        for (MerchantImage merchantImage : list) {
            if ("03".equals(merchantImage.getPhotoType())) {
                vo.setBusinessLicensePic(merchantImage.getPicUrl());
            }
        }
        return vo;
    }
}

