package incheon.product.geoview2d.download.service;

import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

/**
 * 파일 포맷 변환 서비스 인터페이스.
 * PostGIS 데이터를 다양한 포맷으로 변환한다.
 */
public interface FileFormatConverter {

    /**
     * Shapefile 생성.
     */
    Path createShapefile(Path directory, String fileName, List<Map<String, Object>> data,
                         List<String> columns, String spceTy, int srid) throws IOException;

    /**
     * CSV 파일 생성.
     */
    Path createCsvFile(Path directory, String fileName, List<String> columns,
                       Consumer<Consumer<Map<String, Object>>> dataProvider) throws IOException;

    /**
     * Excel 파일 생성.
     */
    Path createExcelFile(Path directory, String fileName, List<String> columns,
                         Consumer<Consumer<Map<String, Object>>> dataProvider) throws IOException;

    /**
     * DXF 파일 생성.
     */
    Path createDxfFile(Path directory, String fileName, List<String> columns,
                       Consumer<Consumer<Map<String, Object>>> dataProvider) throws IOException;

    /**
     * GeoJSON 파일 생성 (스트리밍).
     */
    Path createGeoJsonFile(Path directory, String fileName,
                           Consumer<Consumer<String>> featureProvider) throws IOException;

    /**
     * 파일명 정리.
     */
    String sanitizeFileName(String name);
}
