/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.apache.streampipes.connect.config;

import org.apache.streampipes.config.SpConfig;

public enum ConnectContainerConfig {
  INSTANCE;

  private SpConfig config;

  ConnectContainerConfig() {
    config = SpConfig.getSpConfig("connect-container");

    config.register(ConfigKeys.KAFKA_HOST, "kafka", "Hostname for backend service for kafka");
    config.register(ConfigKeys.KAFKA_PORT, 9092, "Port for backend service for kafka");

    config.register(ConfigKeys.BACKEND_HOST, "backend", "Hostname for backend");
    config.register(ConfigKeys.BACKEND_PORT, 8030, "Port for backend");

//    config.register(ConfigKeys.CONNECT_CONTAINER_MASTER_PORT, Config.MASTER_PORT, "The port of the connect container");
//    config.register(ConfigKeys.CONNECT_CONTAINER_MASTER_HOST, "connect-master", "The hostname of the connect container");

    config.register(ConfigKeys.DATA_LOCATION,"/data/", "Folder that stores all the uploaded data");

  }

  public String getBackendApiUrl() {
    return "http://" + config.getString( ConfigKeys.BACKEND_HOST) + ":" + config.getInteger(ConfigKeys.BACKEND_PORT) + "/streampipes-backend/";
  }

  public String getBackendHost() {
    return config.getString(ConfigKeys.BACKEND_HOST);
  }

  public int getBackendPort() {
    return config.getInteger(ConfigKeys.BACKEND_PORT);
  }

  public String getDataLocation() {
    return config.getString(ConfigKeys.DATA_LOCATION);
  }

  public String getKafkaHost() {
    return config.getString(ConfigKeys.KAFKA_HOST);
  }

  public int getKafkaPort() {
    return config.getInteger(ConfigKeys.KAFKA_PORT);
  }

  public String getKafkaUrl() {
    return getKafkaHost() + ":" + getKafkaPort();
  }


}
