package org.example.mybatisplus.model.auto;

import java.util.Collections;
import java.util.List;

import org.example.mybatisplus.module.AuditResult;
import org.example.mybatisplus.module.BasicInfo;
import org.example.mybatisplus.module.vo.Attachment;

public class CmsEnterpriseRiskInfoDeclaration {

    public void fillBasicInfoVO(BasicInfo basicInfo) {
		basicInfo.setEvaluationLevel(
            getDelcEndWithInfo("基金会评估等级", Collections.singletonList(this))
            .toString());
        basicInfo.setOfficialWebsite(
            getDelcEndWithInfo("机构官网地址", Collections.singletonList(this))
            .toString());
        basicInfo.setFoundationCategory(
            getDelcEndWithInfo("基金会类别", Collections.singletonList(this))
            .toString());
        basicInfo.setInstitutionPurpose(
            getDelcEndWithInfo("机构宗旨", Collections.singletonList(this))
            .toString());
        basicInfo.setLastYearSponsorshipDonationRatio(
            getDelcEndWithInfo("赞助和捐赠额占总社会赞助和捐赠比例（%）", Collections.singletonList(this))
            .toString());
        basicInfo.setLastYearDonationIncome(
            getDelcEndWithInfo("最近一年捐赠收入", Collections.singletonList(this))
            .toString() + "（万元人民币）");
        basicInfo.setInitialFund(
            getDelcEndWithInfo("原始基金", Collections.singletonList(this))
            .toString());
        basicInfo.setOfficeAddress(
            getDelcEndWithInfo("营运地址", Collections.singletonList(this))
            .toString());
        basicInfo.setContactPhone(
            getDelcEndWithInfo("机构有效联系电话", Collections.singletonList(this))
            .toString());
        basicInfo.setFullTimeStaffCount(Integer.valueOf(
            getDelcEndWithInfo("机构全职员工人数", Collections.singletonList(this))
            .toString()));
        basicInfo.setNeedOutsourcingService(
            getDelcEndWithInfo("是否通常需要使用其他协会、基金会或供应商对合作项目进行外包服务", Collections.singletonList(this))
            .toString());
        basicInfo.setProjectServiceVendors(
            getDelcEndWithInfo("请提供项目服务执行方名单（如名单较多，可单独提供副本）", Collections.singletonList(this))
            .toString());
        // todo: 从oss url解析字段
        Attachment attach = new Attachment();
        attach.setFilePath(getDelcFileUrl("关联实体情况", Collections.singletonList(this)));
        basicInfo.setRelatedEntitiesImage(attach);
        basicInfo.setFoundationCertReceived(
            getDelcFileUrl("基金会法人登记证书", Collections.singletonList(this))
            .toString().length() > 3 ? "是" : "否");
        basicInfo.setBankLicense(
            getDelcEndWithInfo("银行开户许可证", Collections.singletonList(this))
            .toString().length() > 3 ? "是" : "否");
        basicInfo.setAnnualInspectionResult(
            getDelcEndWithInfo("年检结果", Collections.singletonList(this))
            .toString());
	}

    public void fillAuditResultVO(AuditResult auditResult) {
        // auditResult.setScore();

    }

    private Object getDelcEndWithInfo(String delcItem, List<CmsEnterpriseRiskInfoDeclaration> declarations) {
        return "value-" + delcItem; // mock
    }

    private String getDelcFileUrl(String delcItem, List<CmsEnterpriseRiskInfoDeclaration> declarations) {
        return "oss://abc";  // mock
    }
}
