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

import com.smppw.modaq.domain.entity.report.ReportNetReportDO;
import com.smppw.modaq.infrastructure.util.DateUtils;
import lombok.Getter;
import lombok.Setter;

/**
 * @author wangzaijun
 * @date 2024/9/26 16:53
 * @description 基协报告净值月报
 */
@Setter
@Getter
public class ReportNetReportDTO extends BaseReportLevelDTO<ReportNetReportDO> {
    /**
     * 估值日期
     */
    private String valuationDate;
    /**
     * 累计净值
     */
    private String cumulativeNavWithdrawal;
    /**
     * 基金份额总额
     */
    private String assetShare;
    /**
     * 基金资产净值
     */
    private String assetNet;
    /**
     * 单位净值
     */
    private String nav;

    public ReportNetReportDTO() {
        super();
    }

    public ReportNetReportDTO(Integer fileId) {
        super(fileId);
    }

    public ReportNetReportDTO(Integer fileId, String level) {
        super(fileId, level);
    }

    @Override
    public ReportNetReportDO toEntity() {
        ReportNetReportDO entity = new ReportNetReportDO();
        entity.setFileId(this.getFileId());
        entity.setLevel(this.getLevel());
        entity.setValuationDate(DateUtils.toDate(this.valuationDate));
        entity.setCumulativeNav(this.toBigDecimal(this.cumulativeNavWithdrawal));
        entity.setEndTotalShares(this.toBigDecimal(this.assetShare));
        entity.setFundAssetSize(this.toBigDecimal(this.assetNet));
        entity.setNav(this.toBigDecimal(this.nav));
        return entity;
    }

    @Override
    public String toString() {
        return "{" +
                super.toString() +
                ", valuationDate='" + valuationDate + '\'' +
                ", cumulativeNavWithdrawal=" + cumulativeNavWithdrawal +
                ", assetShare=" + assetShare +
                ", fundAssetSize=" + assetNet +
                ", nav=" + nav +
                '}';
    }
}
