package incheon.ags.mrb.upload.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@org.egovframe.rte.psl.dataaccess.mapper.Mapper @incheon.com.config.annotation.MainDB public interface ProcessFileMapper {
	// 테이블 존재 여부 확인
    boolean checkTableExists(@Param("tableName") String tableName);
    
    // 1. CSV (XY 좌표) 처리
    void createTable(@Param("tableName") String tableName,
                     @Param("srid") int srid,
                     @Param("columnsSql") String columnsSql);
                     
    void insertRecord(@Param("tableName") String tableName, 
                      @Param("srid") int srid,
                      @Param("x") double x,
                      @Param("y") double y,
                      @Param("columnNames") String columnNames,
                      @Param("columnValues") String columnValues);
    
    // 2. WKT 처리
    void createTableWithGeometry(@Param("tableName") String tableName,
                                 @Param("srid") int srid,
                                 @Param("columnsSql") String columnsSql);

    void insertWktRecord(@Param("tableName") String tableName, 
                         @Param("srid") int srid,
                         @Param("wkt") String wkt,
                         @Param("columnNames") String columnNames,
                         @Param("columnValues") String columnValues);

    // 3. Shapefile 처리
    void createShapefileTable(@Param("tableName") String tableName,
                              @Param("geomType") String geomType,
                              @Param("srid") int srid,
                              @Param("columnsSql") String columnsSql);

    void insertShapefileFeature(@Param("tableName") String tableName, 
                                @Param("srid") int srid,
                                @Param("wkt") String wkt,
                                @Param("columnNames") String columnNames,
                                @Param("columnValues") String columnValues);

    // 4. DXF 처리
    void createDxfTable(@Param("tableName") String tableName,
                        @Param("geomType") String geomType,
                        @Param("srid") int srid,
                        @Param("columnsSql") String columnsSql);

    // 5. 메타데이터(User Layer) 등록
    int insertUserLayer(Map<String, Object> userLayerInfo);
}
