package com.example.reporting.services.impl.pdf; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import com.example.reporting.dto.database.ReportDto; /** * Interface for PDF Parameter */ interface PdfParameter { /** * Returns the filename for the content disposition header. * * @param dto The ReportDto object to extract the filename from. * @return The filename for the content disposition header. */ public abstract String getContentDispositionFilename(ReportDto dto); /** * Returns the HttpHeaders for the PDF response. * * @return The HttpHeaders for the PDF response. */ public abstract HttpHeaders headers(); /** * Returns the HttpHeaders for the PDF response. * * @param dto The ReportDto object to extract the headers from. * @return The HttpHeaders for the PDF response. */ public default HttpHeaders headers(ReportDto dto) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_PDF); headers.setContentDispositionFormData("attachment", getContentDispositionFilename(dto)); return headers; } }