package de.thpeetz.kontor.data.services;

import de.thpeetz.kontor.tysc.services.SportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

@Slf4j
@Service
public class DataManagementService {

    @Autowired
    SportService sportService;

    public DataManagementService() {

    }

    public String getEntry(String nodeName, Map<String, String> fields) {
        AtomicReference<String> status = new AtomicReference<>("unknown");
        switch (nodeName) {
            case "sport":
                status.set(sportService.importData(fields));
            default:
                log.debug("import for {} not implemented", nodeName);
                break;
        }
        return status.get();
    }
}
