package com.cool.store.request.xgj;

import com.cool.store.entity.FranchiseFeeDO;
import com.cool.store.enums.FranchiseBrandEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;

import static com.cool.store.utils.CommonUtil.convertToBig;

/**
 * @Author suzhuhong
 * @Date 2025/6/3 16:52
 * @Version 1.0
 */
@Data
public class PushFranchiseFeeRequest {

    @ApiModelProperty( "CRM系统门店ID")
    private Long shopId;

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

    @ApiModelProperty( "账单ID")
    private Integer billId;

    @ApiModelProperty( "加盟费")
    private BigDecimal franchiseFee;

    @ApiModelProperty( "保证金")
    private BigDecimal bond;

    @ApiModelProperty( "第一年度管理费")
    private BigDecimal firstYearManageFee;

    @ApiModelProperty( "第一年度品牌使用费")
    private BigDecimal firstYearFee;

    @ApiModelProperty( "设计费")
    private BigDecimal designFee;

    @ApiModelProperty( "应缴费合计金额")
    private BigDecimal totalFee;

    @ApiModelProperty( "创建时间")
    private Date createTime;
    
    @ApiModelProperty("品牌")
    private Integer joinBrand;

    public  PushFranchiseFeeRequest(){}
    public  PushFranchiseFeeRequest(Long shopId, String partnerName, FranchiseFeeDO franchiseFeeDO,Integer joinBrand){
        this.setShopId(shopId);
        this.setPartnerName(partnerName);
        this.setBillId(franchiseFeeDO.getId().intValue());
        this.setFranchiseFee(convertToBig(franchiseFeeDO.getYearFranchiseFee()));
        this.setBond(convertToBig(franchiseFeeDO.getLoanMargin()));
        this.setFirstYearManageFee(convertToBig(franchiseFeeDO.getFirstYearManageFee()));
        this.setFirstYearFee(convertToBig(franchiseFeeDO.getFirstYearFee()));
        this.setDesignFee(convertToBig(franchiseFeeDO.getPerformanceBond()));
        // 三明治收银费 不为空 且不为零的时候
        if (FranchiseBrandEnum.ZXSMZ.getCode()==joinBrand) {
            this.setFranchiseFee(convertToBig(franchiseFeeDO.getCashierFee()));
        }
        this.setTotalFee(this.getBond()
                .add(this.getFranchiseFee())
                .add(this.getFirstYearManageFee())
                .add(this.getFirstYearFee())
                .add(this.getDesignFee()));
        this.setCreateTime(franchiseFeeDO.getCreateTime());
    }

    public static void main(String[] args) {
        BigDecimal bigDecimal = new BigDecimal(0.00);

    }

}
