package com.capgemini.reports.builder;

import com.capgemini.reports.database.javabean.enumeration.ReportCriteriaEnum;
import com.capgemini.reports.exceptions.InsufficientParametersException;
import com.capgemini.reports.execution.AbstractExecutionReport;

import java.util.Map;

/**
 * This interface allows creating a report from a map of functional {@link ReportCriteriaEnum}s and values.<br>
 * All ReportBuilders will be accessed <i>via</i> Reflection, so for future compatibility <b>DO NOT move this package.</b><br>
 * Otherwise the fully-qualified class names (saved in DB for scheduled reports) will be lost.<br>
 * Also, all implementations <b>must</b> have a no-args constructor.
 */
public interface ReportBuilder {
    /**
     * Re-construct a report from its DB parameters.
     * 
     * @param data the necessary data for reconstructing the report, obtained from the DB.
     * 
     * @return the re-constructed report.
     * 
     * @throws InsufficientParametersException if some required arguments are missing/non-understandable.
     */
    AbstractExecutionReport<?, ?> build(Map<ReportCriteriaEnum, String> data) throws InsufficientParametersException;
}
