package de.avatic.lcc.repositories;

import de.avatic.lcc.service.api.EUTaxationApiService;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class NomenclatureRepository {

    private final JdbcTemplate jdbcTemplate;
    private final EUTaxationApiService eUTaxationApiService;

    public NomenclatureRepository(JdbcTemplate jdbcTemplate, EUTaxationApiService eUTaxationApiService) {
        this.jdbcTemplate = jdbcTemplate;
        this.eUTaxationApiService = eUTaxationApiService;
    }

    public List<String> searchHsCode(String search) {
        String sql = """
                SELECT hs_code FROM nomenclature WHERE hs_code LIKE CONCAT(?, '%') LIMIT 10
                """;

        return jdbcTemplate.queryForList (sql, String.class, search);
    }

}
