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

import com.smppw.modaq.common.conts.Constants;
import com.smppw.modaq.domain.entity.report.BaseReportDO;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author wangzaijun
 * @date 2024/10/9 11:08
 * @description 抽象的报告数据父类，全部字段用string传递
 */
@Setter
@Getter
public abstract class BaseReportDTO<T extends BaseReportDO> implements Serializable {
    @Serial
    private static final long serialVersionUID = Constants.DEFAULT_SERIAL_ID;

    private Integer fileId;

    public BaseReportDTO() {
    }

    public BaseReportDTO(Integer fileId) {
        this.fileId = fileId;
    }

    public abstract T toEntity();

    protected void initEntity(T entity) {
        entity.setCreatorId(0);
        entity.setCreateTime(new Date());
        entity.setUpdaterId(0);
        entity.setUpdateTime(new Date());
        entity.setValid(1);
    }

    @Override
    public String toString() {
        return "fileId=" + fileId;
    }
}
