package cz.senslog.connector.fetch.metno;

import cz.senslog.connector.fetch.api.ExecutableFetcher;
import cz.senslog.connector.model.config.DefaultConfig;
import cz.senslog.connector.model.converter.MetnoToSensLogConverter;
import cz.senslog.connector.model.metno.MetnoModel;
import org.junit.jupiter.api.Test;

import java.util.*;

import static org.junit.jupiter.api.Assertions.*;

class MetnoFetcherTest {

    @Test
    void fetch() throws Exception {
        ConnectorFetchMetnoProvider provider = new ConnectorFetchMetnoProvider();

        DefaultConfig defaultConfig = new DefaultConfig("", null);

        defaultConfig.setProperty("baseUrl", "https://api.met.no/weatherapi/locationforecast/2.0/complete");
        defaultConfig.setProperty("timeZone", "Europe/Prague");

        Map<String, Object> st1 = new HashMap<String, Object>() {{
            put("location", Arrays.asList(13.351931666613327, 49.72680307543005));
        }};

//        defaultConfig.setProperty("allowedStations", Collections.singletonList(st1));
        defaultConfig.setProperty("allowedStationURL", "https://sensor.lesprojekt.cz/senslogOTS3/rest/forecast/locationforecast/plan");

        ExecutableFetcher<MetnoModel> fetcher = provider.createExecutableFetcher(defaultConfig);
        fetcher.getRawFetcher().init();
        fetcher.execute();
    }
}