package com.smppw.modaq.domain.dto.report;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class LetterReportData extends ReportData {
    private ReportInvestorInfoDTO investorInfo;
    private ReportFundTransactionDTO fundTransaction;

    public LetterReportData(ReportBaseInfoDTO baseInfo, ReportFundInfoDTO fundInfo) {
        super(baseInfo, fundInfo);
    }

    @Override
    public boolean wasFailed() {
        boolean superFlag = !super.wasFailed();
        if (!superFlag) {
            return true;
        }
        if (this.investorInfo == null || fundTransaction == null) {
            return true;
        }
        return StrUtil.isBlank(this.investorInfo.getInvestorName())
                || StrUtil.isBlank(this.fundTransaction.getFundName());
    }

    @Override
    public String toString() {
        return "{" +
                super.toString() +
                ", investorInfo=" + investorInfo +
                ", fundTransaction=" + fundTransaction +
                '}';
    }
}
