package cz.senslog.connector.fetch.soilscount;

import cz.senslog.connector.fetch.api.ConnectorFetcher;
import cz.senslog.connector.fetch.api.FetchProxySession;
import cz.senslog.connector.model.soilscount.SoilscountModel;
import cz.senslog.connector.tools.http.HttpClient;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Optional;

public class ProxySession extends FetchProxySession<SessionModel, SoilscountModel> {

    private static final Logger logger = LogManager.getLogger(ProxySession.class);

    private final HttpClient httpClient;

    public ProxySession(ConnectorFetcher<SessionModel, SoilscountModel> fetcher, HttpClient httpClient) {
        super(fetcher);
        this.httpClient = httpClient;
    }

    @Override
    protected SessionModel preProcessing(Optional<SessionModel> previousSession) {
        SessionModel session = previousSession.filter(SessionModel::isActive).orElseGet(() -> new SessionModel(true));

        // TODO

        return session;
    }

    @Override
    protected void postProcessing(Optional<SoilscountModel> model, Optional<SessionModel> session) {

    }
}
