package com.capgemini.reports.definition.r13report.execution;

import com.capgemini.reports.JasperTemplate;
import com.capgemini.reports.builder.R13CrBuilder;
import com.capgemini.reports.builder.ReportBuilder;
import com.capgemini.reports.changeobjects.change.TcChangeRequestRevision;
import com.capgemini.reports.definition.r13report.datapreparator.DataReportPreparatorR13CR;
import com.capgemini.reports.execution.AbstractExecutionReport;
import com.capgemini.reports.execution.IDataReportPreparator;
import com.capgemini.reports.reports.parameters.EffectivityDate;
import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
 * This class controls the execution of a R13 report with CR objects.
 */
@Getter
@EqualsAndHashCode(callSuper = true)
public class ExecutionR13CR extends AbstractExecutionR13<ExecutionR13CR, TcChangeRequestRevision> {

    private static final long serialVersionUID = 2186783921659331654L;

    /**
     * Constructor.
     *
     * @param finalDate {@link EffectivityDate} -the final date
     * @param beginDate {@link EffectivityDate} -the previous date
     */
    public ExecutionR13CR(final EffectivityDate finalDate, final EffectivityDate beginDate) {
        super("CR", finalDate, beginDate);
    }

    @Override
    public String getTemplateLocation() {
        return JasperTemplate.TEMPLATE_R13_CR.getFilepath();
    }

    @Override
    public IDataReportPreparator<ExecutionR13CR> getDataPreparator() {
        return new DataReportPreparatorR13CR();
    }

    @Override
    public AbstractExecutionReport<?, ?> cloneTemplateToExecution() {
        return new ExecutionR13CR(finalDate, startDate);
    }

    @Override
    public Class<? extends ReportBuilder> getReportBuilderClass() {
        return R13CrBuilder.class;
    }
}
