package com.cool.store.response;

import com.cool.store.entity.FranchiseFeeDO;
import com.cool.store.entity.LinePayDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Data
public class FranchiseFeeResponse {
    private Long id;
    @ApiModelProperty("shopId")
    private Long shopId;
    @ApiModelProperty("payId")
    private Long payId;
    @ApiModelProperty("每年加盟费")
    private String yearFranchiseFee;
    @ApiModelProperty("贷款保证金")
    private String loanMargin;
    @ApiModelProperty("第一年度开始时间")
    private Date firstYearStartTime;
    @ApiModelProperty("第一年度结束时间")
    private Date firstYearEndTime;
    @ApiModelProperty("第一年度加盟费")
    private String firstYearFee;
    @ApiModelProperty("第二年度开始时间")
    private Date secondYearStartTime;
    @ApiModelProperty("第二年度结束时间")
    private Date secondYearEndTime;
    @ApiModelProperty("第二年度加盟费")
    private String secondYearFee;
    @ApiModelProperty("第仨年度开始时间")
    private Date thirdYearStartTime;
    @ApiModelProperty("第仨年度结束时间")
    private Date thirdYearEndTime;
    @ApiModelProperty("第仨年度加盟费")
    private String thirdYearFee;
    @ApiModelProperty("履约保证金")
    private String performanceBond;
    private Date createTime;
    private Date updateTime;

    private LinePay linePayDO;

    @Data
    public static class LinePay{
        @ApiModelProperty("")
        private Long id;

        @ApiModelProperty("xfsg_user_info.partner_id")
        private String partnerId;

        @ApiModelProperty("line_info.id")
        private Long lineId;

        @ApiModelProperty("支付状态 45:待缴费 50:已缴费 55缴费失败")
        private Integer payStatus;

        @ApiModelProperty("支付方式 1微信 2银行转账")
        private Integer payType;

        @ApiModelProperty("付款人姓名")
        private String payUserName;

        @ApiModelProperty("付款账号")
        private String payAccount;

        @ApiModelProperty("开户行code")
        private String bankCode;

        @ApiModelProperty("开户行名称")
        private String bankName;

        @ApiModelProperty("支行code")
        private String branchBankCode;

        @ApiModelProperty("支行名称")
        private String branchBankName;

        @ApiModelProperty("缴纳时间")
        private Date payTime;

        @ApiModelProperty("付款截图")
        private String payPic;

        @ApiModelProperty("承诺书图片")
        private String promisePic;

        @ApiModelProperty("创建时间")
        private Date createTime;

        @ApiModelProperty("更新时间")
        private Date updateTime;

        @ApiModelProperty("创建人")
        private String createUserId;

        @ApiModelProperty("更新人")
        private String updateUserId;

        @ApiModelProperty("是否删除：0.否 1.是")
        private Boolean deleted;

        @ApiModelProperty("支付类型 0-缴纳意向金 1-缴纳加盟费 2-装修款")
        private Integer payBusinessType;

        @ApiModelProperty("缴费金额")
        private String amount;

        @ApiModelProperty("加盟商姓名")
        private String partnerName;

        @ApiModelProperty("审核原因")
        private String result;

        @ApiModelProperty("审核状态 0通过,1拒绝")
        private Integer status;

        public static LinePay from(LinePayDO linePayDO) {
            if (linePayDO == null) {
                return null;
            }
            LinePay linePayDO1 = new LinePay();
            linePayDO1.setId(linePayDO.getId());
            linePayDO1.setPartnerId(linePayDO.getPartnerId());
            linePayDO1.setLineId(linePayDO.getLineId());
            linePayDO1.setPayStatus(linePayDO.getPayStatus());
            linePayDO1.setPayType(linePayDO.getPayType());
            linePayDO1.setPayUserName(linePayDO.getPayUserName());
            linePayDO1.setPayAccount(linePayDO.getPayAccount());
            linePayDO1.setBankCode(linePayDO.getBankCode());
            linePayDO1.setBankName(linePayDO.getBankName());
            linePayDO1.setBranchBankCode(linePayDO.getBranchBankCode());
            linePayDO1.setBranchBankName(linePayDO.getBranchBankName());
            linePayDO1.setPayTime(linePayDO.getPayTime());
            linePayDO1.setPayPic(linePayDO.getPayPic());
            linePayDO1.setPromisePic(linePayDO.getPromisePic());
            linePayDO1.setCreateTime(linePayDO.getCreateTime());
            linePayDO1.setUpdateTime(linePayDO.getUpdateTime());
            linePayDO1.setCreateUserId(linePayDO.getCreateUserId());
            linePayDO1.setUpdateUserId(linePayDO.getUpdateUserId());
            linePayDO1.setDeleted(linePayDO.getDeleted());
            linePayDO1.setPayBusinessType(linePayDO.getPayBusinessType());
            return linePayDO1;
        }
    }



    public static FranchiseFeeResponse from(FranchiseFeeDO franchiseFeeDO) {
        if (franchiseFeeDO == null) {
            return null;
        }
        FranchiseFeeResponse franchiseFeeResponse = new FranchiseFeeResponse();
        franchiseFeeResponse.setId(franchiseFeeDO.getId());
        franchiseFeeResponse.setShopId(franchiseFeeDO.getShopId());
        franchiseFeeResponse.setPayId(franchiseFeeDO.getPayId());
        franchiseFeeResponse.setYearFranchiseFee(franchiseFeeDO.getYearFranchiseFee());
        franchiseFeeResponse.setLoanMargin(franchiseFeeDO.getLoanMargin());
        franchiseFeeResponse.setFirstYearStartTime(franchiseFeeDO.getFirstYearStartTime());
        franchiseFeeResponse.setFirstYearEndTime(franchiseFeeDO.getFirstYearEndTime());
        franchiseFeeResponse.setFirstYearFee(franchiseFeeDO.getFirstYearFee());
        franchiseFeeResponse.setSecondYearStartTime(franchiseFeeDO.getSecondYearStartTime());
        franchiseFeeResponse.setSecondYearEndTime(franchiseFeeDO.getSecondYearEndTime());
        franchiseFeeResponse.setSecondYearFee(franchiseFeeDO.getSecondYearFee());
        franchiseFeeResponse.setThirdYearStartTime(franchiseFeeDO.getThirdYearStartTime());
        franchiseFeeResponse.setThirdYearEndTime(franchiseFeeDO.getThirdYearEndTime());
        franchiseFeeResponse.setThirdYearFee(franchiseFeeDO.getThirdYearFee());
        franchiseFeeResponse.setPerformanceBond(franchiseFeeDO.getPerformanceBond());
        franchiseFeeResponse.setCreateTime(franchiseFeeDO.getCreateTime());
        franchiseFeeResponse.setUpdateTime(franchiseFeeDO.getUpdateTime());
        return franchiseFeeResponse;
    }
}
