package de.avatic.taric.service;


import de.avatic.taric.error.ArgumentException;
import de.avatic.taric.model.Nomenclature;
import org.springframework.stereotype.Service;

@Service
public class TariffService {

    private final GeoService geoService;
    private final NomenclatureService nomenclatureService;

    public TariffService(GeoService geoService, NomenclatureService nomenclatureService) {
        this.geoService = geoService;
        this.nomenclatureService = nomenclatureService;
    }

    public void importTariffs(String hsCode, String countryCode) {

        var geoGroups = geoService.getGeoGroupByCountryCode(countryCode);
        var geo = geoService.getGeo(countryCode);

        var nomenclature = nomenclatureService.getNomenclature(hsCode);
        var cascade = nomenclatureService.getNomenclatureCascade(hsCode);

        if(nomenclature.isEmpty() || !nomenclature.get().getIsLeaf()) throw new ArgumentException("hsCode");
        if(geo.isEmpty()) throw new ArgumentException("countryCode");




    }

}
