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

import com.smppw.modaq.domain.entity.report.ReportShareChangeDO;
import com.smppw.modaq.infrastructure.util.ConvertUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * @author wangzaijun
 * @date 2024/9/26 16:40
 * @description 基金份额变动情况
 */
@Setter
@Getter
public class ReportShareChangeDTO extends BaseReportLevelDTO<ReportShareChangeDO> {
    /**
     * 报告期期初基金份额总额
     */
    private String initTotalShares;
    /**
     * 减: 报告期期间基金总赎回份额
     */
    private String redemption;
    /**
     * 期末基金总份额/期末基金实缴总额
     */
    private String sharePerAsset;
    /**
     * 报告期期间基金拆分变动份额
     */
    private String splitChangeShare;
    /**
     * 报告期期间基金总申购份额
     */
    private String subscription;

    public ReportShareChangeDTO() {
        super();
    }

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

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

    @Override
    public ReportShareChangeDO toEntity() {
        ReportShareChangeDO entity = new ReportShareChangeDO();
        entity.setFileId(this.getFileId());
        entity.setLevel(this.getLevel());
        entity.setRedemption(ConvertUtil.toBigDecimal(this.redemption));
        entity.setInitTotalShares(ConvertUtil.toBigDecimal(this.initTotalShares));
        entity.setSharePerAsset(ConvertUtil.toBigDecimal(this.sharePerAsset));
        entity.setSplit(ConvertUtil.toBigDecimal(this.splitChangeShare));
        entity.setSubscription(ConvertUtil.toBigDecimal(this.subscription));
        return entity;
    }

    @Override
    public String toString() {
        return "{" +
                super.toString() +
                ", initTotalShares=" + initTotalShares +
                ", redemption=" + redemption +
                ", sharePerAsset=" + sharePerAsset +
                ", splitChangeShare=" + splitChangeShare +
                ", subscription=" + subscription +
                '}';
    }
}
