package com.simuwang.base.pojo.dto;

import com.simuwang.base.pojo.dos.FundPositionDetailDO;
import com.simuwang.base.pojo.dos.ValuationTableDO;
import com.simuwang.base.pojo.valuation.CmValuationTableAttribute;
import lombok.Data;

import java.util.List;
import java.util.Objects;

@Data
public class EmailFundNavDTO {
    /**
     * 邮件解析的基金名称
     */
    private String fundName;
    /**
     * 邮件解析的备案编码
     */
    private String registerNumber;
    /**
     * 净值日期
     */
    private String priceDate;
    /**
     * 单位净值
     */
    private String nav;
    /**
     * 累计单位净值
     */
    private String cumulativeNavWithdrawal;
    /**
     * 虚拟净值
     */
    private String virtualNav;
    /**
     * 资产份额
     */
    private String assetShare;
    /**
     * 资产净值(基金规模)
     */
    private String assetNet;
    /**
     * 模板id(0-通用模板)
     */
    private Integer templateId;
    /**
     * 匹配上的基金id
     */
    private List<String> fundIdList;
    /**
     * 解析状态:1-成功,2-净值缺失，3-未匹配基金，4-净值<=0,5-资产净值<=0
     */
    private Integer parseStatus;

    /**
     * 估值表信息
     */
    private ValuationTableDO valuationTableDO;
    /**
     * 估值表明细信息
     */
    private List<FundPositionDetailDO> fundPositionDetailDOList;
    /**
     * 估值表原始信息
     */
    private List<CmValuationTableAttribute> valuationTableAttributeList;
    /**
     * 失败原因
     */
    private String failReason;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        EmailFundNavDTO that = (EmailFundNavDTO) o;
        return Objects.equals(fundName, that.fundName) && Objects.equals(registerNumber, that.registerNumber) && Objects.equals(priceDate, that.priceDate)
                && Objects.equals(nav, that.nav) && Objects.equals(cumulativeNavWithdrawal, that.cumulativeNavWithdrawal) && Objects.equals(assetShare, that.assetShare) && Objects.equals(assetNet, that.assetNet);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fundName, registerNumber, priceDate, nav, cumulativeNavWithdrawal, assetShare, assetNet);
    }
}
