// Copyright (c) 2020 UWB & LESP.
// The UWB & LESP license this file to you under the MIT license.

package cz.senslog.connector.app.config;

import cz.senslog.connector.app.config.api.ConfigurationService;
import cz.senslog.connector.app.config.api.DatabaseConfigurationService;
import cz.senslog.connector.model.config.ConnectorDescriptor;
import cz.senslog.connector.model.config.DefaultConfig;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Set;

import static java.lang.String.format;

/**
 * The class {@code DatabaseConfigurationServiceImpl} represents an implementation of {@link DatabaseConfigurationService}.
 *
 * @author Lukas Cerny
 * @version 1.0
 * @since 1.0
 */
class DatabaseConfigurationServiceImpl implements ConfigurationService, DatabaseConfigurationService {

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

    /** Connection url to a database. */
    private final String connectionUrl;

    /** Username to a database. */
    private final String username;

    /** Password to a database. */
    private final String password;

    /** Name of connector in a database. */
    private final String connectorName;

    /**
     * Constructor sets all attributes.
     * @param connectionUrl - connection url.
     * @param username - username.
     * @param password - password.
     */
    DatabaseConfigurationServiceImpl(String connectionUrl, String username, String password, String connectorName) {
        this.connectionUrl = connectionUrl;
        this.username = username;
        this.password = password;
        this.connectorName = connectorName;
    }

    @Override
    public void connect() {
        throw logger.throwing(new UnsupportedOperationException(format(
                "%s#connect() is not implemented.", DatabaseConfigurationServiceImpl.class
        )));
    }

    @Override
    public Set<ConnectorDescriptor> getConnectorDescriptors() {
        return null;
    }

    @Override
    public DefaultConfig getConfigForProviderId(String providerId) {
        return null;
    }
}
