import { validateVariant } from '../definitionUtils.js';

class TemplateBuilder {
    variant;
    specification;
    columns = [];
    sections = [];
    data;
    fields;
    sectionFields = [];
    template;
    reportQuery;
    pageSummaries;
    summaries;
    constructor(variant) {
        const { specification } = validateVariant(variant);
        const { template, fields, sections } = specification;
        this.variant = variant;
        this.specification = specification;
        this.template = template;
        this.fields = fields;
        this.sections = sections;
    }
    withColumns(columns) {
        this.columns = columns;
        return this;
    }
    withData(data) {
        this.data = data;
        return this;
    }
    withQuery(reportQuery) {
        this.reportQuery = reportQuery;
        return this;
    }
    withSummaries(summariesData) {
        this.pageSummaries = summariesData.filter((summary) => {
            return summary.template.includes('page');
        });
        this.summaries = summariesData.filter((summary) => {
            return summary.template.includes('section') || summary.template.includes('table');
        });
        return this;
    }
}

export { TemplateBuilder };
//# sourceMappingURL=TemplateBuilder.js.map
