package com.libreecm.commonAPI.configuration;

import java.util.ArrayList;
import java.util.Arrays;

/** 
 * Default configuration for this component. It's override by a XML file, if found
 * Any field should be mapped to file src/resources/mapping.xml for a correct Marshall/Unmarshall process
 * @author Jordi Pérez Bayerri
 *
 */ 
public class Config {
	
	//IMPORTANT: ANY CHANGE HERE, SHOULD BE MAPPED AT src/resources/mapping.xml 
	//These ports only affects when at spring-boot run environment
	private static Integer libreECMConfiguratorLocalPort=8080;
	private static Integer libreECMDDBBLocalPort=8080;
	private static Integer libreECMInputLocalPort=8080;
	private static Integer libreECMLocalPort=8080;
	private static Integer libreECMOpenCMISLocalPort=8080;
	private static String mainComponentUrl="http://localhost:"+libreECMLocalPort+"/LibreECMMain-0.1.0";
	
	private static String dbComponentUrl="http://localhost:"+libreECMDDBBLocalPort+"/LibreECMDDBB-0.1.0";
	private static String inputComponentUrl="http://localhost:"+libreECMInputLocalPort+"/LibreECMInput-0.1.0";

	private String dbAclCapabilitiesUrl=dbComponentUrl+"/aclCapabilities";
	private String dbConfigUrl=dbComponentUrl+"/config";
	
	private String dbCreatablePropertyUrl=dbComponentUrl+"/creatableProperty";
	private String dbCurrentUserUrl=dbComponentUrl+"/currentuser";
	private String dbDBUrl="jdbc:postgresql://localhost:5432/LibreECMDDBB";
	private String dbExtensionUrl=dbComponentUrl+"/extension";
	private String dbNewTypeSettableAttributesUrl=dbComponentUrl+"/newTypeSettableAttributes";
	private String dbPassword="primax";
	private String dbPropertyDefinitionUrl=dbComponentUrl+"/propertydefinition";
	private String dbRepositoriesUrl=dbComponentUrl+"/repositories";
	private String dbRepositoryByIdUrl=dbComponentUrl+"/repositorybyid";
	private String dbRepositoryCapabilitiesUrl=dbComponentUrl+"/repositoryCapabilities";
	private String dbRepositoryUrl=dbComponentUrl+"/repository";
	private String dbTypeChildrenUrl=dbComponentUrl+"/typechildren";
	private String dbUsername="postgres";

	
	private String dbUserUrl=dbComponentUrl+"/user";
	private String driverClassName="org.postgresql.Driver";
	private String inputConfigUrl=inputComponentUrl+"/config";
	private String inputCurrentUserUrl=inputComponentUrl+"/currentuser";
	private String inputDownloadObjectUrl=inputComponentUrl+"/downloadcontent";
	private String inputObjectsInFolderUrl=inputComponentUrl+"/objectsinfolder";
	private String inputObjectTypeUrl=inputComponentUrl+"/objecttype";
	private String inputObjectUrl=inputComponentUrl+"/object";
	
	
	private String inputRepositoryUrl=inputComponentUrl+"/repository";
	private String inputUploadObjectUrl=inputComponentUrl+"/uploadcontent";
	private String mainConfigUrl=mainComponentUrl+"/config";
	private String mainCurrentUserUrl=mainComponentUrl+"/currentuser";
	private String mainDownloadObjectUrl=mainComponentUrl+"/downloadcontent";
	private String mainNewTypeSettableAttributesUrl=mainComponentUrl+"/newTypeSettableAttributes";
	private String mainObjectsInFolderUrl=mainComponentUrl+"/objectsinfolder";
	private String mainObjectTypeUrl=mainComponentUrl+"/objecttype";
	private String mainObjectUrl=mainComponentUrl+"/object";
	private String mainPropertyDefinitionUrl=mainComponentUrl+"/propertydefinition";
	private String mainRepositoriesUrl=mainComponentUrl+"/repositories";
	private String mainRepositoryByIdUrl=mainComponentUrl+"/repositorybyid";
	private String mainRepositoryUrl=mainComponentUrl+"/repository";


	private String mainTypeChildrenUrl=mainComponentUrl+"/typechildren";
	private String mainUserUrl=mainComponentUrl+"/user";
	
	
	//This sets a repository to the system, if exists reads it
	private String[] repositoriesArray={};
	private ArrayList<String> repositories=new ArrayList<String>
	(Arrays.asList(repositoriesArray));


	/**
	 * @return the dbUrl
	 */
	public static String getDbUrl() {
		return dbComponentUrl;
	}	
	/**
	 * @return the inputUrl
	 */
	public static String getInputUrl() {
		return inputComponentUrl;
	}
	/**
	 * @return the mainUrl
	 */
	public static String getMainUrl() {
		return mainComponentUrl;
	}
	/**
	 * @param dbUrl the dbUrl to set
	 */
	public static void setDbUrl(String dbUrl) {
		Config.dbComponentUrl = dbUrl;
	}
	
	/**
	 * @param inputUrl the inputUrl to set
	 */
	public static void setInputUrl(String inputUrl) {
		Config.inputComponentUrl = inputUrl;
	}
	/**
	 * @param mainUrl the mainUrl to set
	 */
	public static void setMainUrl(String mainUrl) {
		Config.mainComponentUrl = mainUrl;
	}
		/**
	 * @return the dbAclCapabilitiesUrl
	 */
	public String getDbAclCapabilitiesUrl() {
		return dbAclCapabilitiesUrl;
	}
	/**
	 * @return the dbConfigUrl
	 */
	public String getDbConfigUrl() {
		return dbConfigUrl;
	}
	/**
	 * @return the dbCreatablePropertyUrl
	 */
	public String getDbCreatablePropertyUrl() {
		return dbCreatablePropertyUrl;
	}
	/**
	 * @return the dbCurrentUserUrl
	 */
	public String getDbCurrentUserUrl() {
		return dbCurrentUserUrl;
	}
	/**
	 * @return the url
	 */
	public String getDbDBUrl() {
		return dbDBUrl;
	}
	/**
	 * @return the dbExtensionUrl
	 */
	public String getDbExtensionUrl() {
		return dbExtensionUrl;
	}
	
	/**
	 * @return the dbNewTypeSettableAttributesUrl
	 */
	public String getDbNewTypeSettableAttributesUrl() {
		return dbNewTypeSettableAttributesUrl;
	}
	/**
	 * @return the password
	 */
	public String getDbPassword() {
		return dbPassword;
	}
	public String getDbPropertyDefinitionUrl() {
		return this.dbPropertyDefinitionUrl;
	}
	/**
	 * @return the dbRepositoriesUrl
	 */
	public String getDbRepositoriesUrl() {
		return dbRepositoriesUrl;
	}
	public String getDbRepositoryByIdUrl() {
		return this.dbRepositoryByIdUrl;
	}
	/**
	 * @return the dbRepositoryCapabilitiesUrl
	 */
	public String getDbRepositoryCapabilitiesUrl() {
		return dbRepositoryCapabilitiesUrl;
	}
	/**
	 * @return the dbRepositoryUrl
	 */
	public String getDbRepositoryUrl() {
		return dbRepositoryUrl;
	}
	/**
	 * @return the dbTypeChildrenUrl
	 */
	public String getDbTypeChildrenUrl() {
		return dbTypeChildrenUrl;
	}
	/**
	 * @return the username
	 */
	public String getDbUsername() {
		return dbUsername;
	}
	/**
	 * @return the dbUserUrl
	 */
	public String getDbUserUrl() {
		return dbUserUrl;
	}
	
	
	/**
	 * @return the driverClassName
	 */
	public String getDriverClassName() {
		return driverClassName;
	}
	/**
	 * @return the inputConfigUrl
	 */
	public String getInputConfigUrl() {
		return inputConfigUrl;
	}
	/**
	 * @return the inputCurrentUserUrl
	 */
	public String getInputCurrentUserUrl() {
		return inputCurrentUserUrl;
	}
	public String getInputDownloadObjectUrl() {
		return this.inputDownloadObjectUrl;
	}
	public String getInputObjectsInFolerUrl() {
		return this.inputObjectsInFolderUrl;
	}
	public String getInputObjectTypeUrl() {
		return this.inputObjectTypeUrl;
	}
	/**
	 * @return the inputObjectUrl
	 */
	public String getInputObjectUrl() {
		return inputObjectUrl;
	}
	public String getInputRepositoryUrl() {
		return this.inputRepositoryUrl;
	}
	/**
	 * @return the inputUploadObjectUrl
	 */
	public String getInputUploadObjectUrl() {
		return inputUploadObjectUrl;
	}
	/**
	 * @return the libreECMConfiguratorLocalPort
	 */
	public Integer getLibreECMConfiguratorLocalPort() {
		return libreECMConfiguratorLocalPort;
	}
	/**
	 * @return the libreECMDDBBLocalPort
	 */
	public Integer getLibreECMDDBBLocalPort() {
		return libreECMDDBBLocalPort;
	}
	/**
	 * @return the libreECMInputLocalPort
	 */
	public Integer getLibreECMInputLocalPort() {
		return libreECMInputLocalPort;
	}
	/**
	 * @return the libreECMLocalPort
	 */
	public Integer getLibreECMLocalPort() {
		return libreECMLocalPort;
	}
	/**
	 * @return the libreECMOpenCMISLocalPort
	 */
	public Integer getLibreECMOpenCMISLocalPort() {
		return libreECMOpenCMISLocalPort;
	}
	/**
	 * @return the mainConfigUrl
	 */
	public String getMainConfigUrl() {
		return mainConfigUrl;
	}
	/**
	 * @return the mainCurrentUserUrl
	 */
	public String getMainCurrentUserUrl() {
		return mainCurrentUserUrl;
	}
	
	public String getMainDownloadObjectUrl() {
		return this.mainDownloadObjectUrl;
	}
	/**
	 * @return the mainNewTypeSettableAttributesUrl
	 */
	public String getMainNewTypeSettableAttributesUrl() {
		return mainNewTypeSettableAttributesUrl;
	}
	public String getMainObjectsInFolderUrl() {
		return this.mainObjectsInFolderUrl;
	}
	/**
	 * @return the mainObjectTypeUrl
	 */
	public String getMainObjectTypeUrl() {
		return mainObjectTypeUrl;
	}
	/**
	 * @return the mainObjectUrl
	 */
	public String getMainObjectUrl() {
		return mainObjectUrl;
	}
	/**
	 * @return the mainPropertyDefinitionUrl
	 */
	public String getMainPropertyDefinitionUrl() {
		return mainPropertyDefinitionUrl;
	}
	/**
	 * @return the mainRepositoriesUrl
	 */
	public String getMainRepositoriesUrl() {
		return mainRepositoriesUrl;
	}
	public String getMainRepositoryByIdUrl() {
		return this.mainRepositoryByIdUrl;
	}
	/**
	 * @return the mainRepositoryUrl
	 */
	public String getMainRepositoryUrl() {
		return mainRepositoryUrl;
	}
	/**
	 * @return the mainTypeChildrenUrl
	 */
	public String getMainTypeChildrenUrl() {
		return mainTypeChildrenUrl;
	}
	/**
	 * @return the mainUserUrl
	 */
	public String getMainUserUrl() {
		return mainUserUrl;
	}
	/**
	 * @return the repositories
	 */
	public ArrayList<String> getRepositories() {
		return repositories;
	}
	/**
	 * @param dbAclCapabilitiesUrl the dbAclCapabilitiesUrl to set
	 */
	public void setDbAclCapabilitiesUrl(String dbAclCapabilitiesUrl) {
		this.dbAclCapabilitiesUrl = dbAclCapabilitiesUrl;
	}
	/**
	 * @param dbConfigUrl the dbConfigUrl to set
	 */
	public void setDbConfigUrl(String dbConfigUrl) {
		this.dbConfigUrl = dbConfigUrl;
	}
	/**
	 * @param dbCreatablePropertyUrl the dbCreatablePropertyUrl to set
	 */
	public void setDbCreatablePropertyUrl(String dbCreatablePropertyUrl) {
		this.dbCreatablePropertyUrl = dbCreatablePropertyUrl;
	}
	/**
	 * @param dbCurrentUserUrl the dbCurrentUserUrl to set
	 */
	public void setDbCurrentUserUrl(String dbCurrentUserUrl) {
		this.dbCurrentUserUrl = dbCurrentUserUrl;
	}
	

	/**
	 * @param url the url to set
	 */
	public void setDbDBUrl(String url) {
		this.dbDBUrl = url;
	}
	/**
	 * @param dbExtensionUrl the dbExtensionUrl to set
	 */
	public void setDbExtensionUrl(String dbExtensionUrl) {
		this.dbExtensionUrl = dbExtensionUrl;
	}
	/**
	 * @param dbNewTypeSettableAttributesUrl the dbNewTypeSettableAttributesUrl to set
	 */
	public void setDbNewTypeSettableAttributesUrl(String dbNewTypeSettableAttributesUrl) {
		this.dbNewTypeSettableAttributesUrl = dbNewTypeSettableAttributesUrl;
	}
	/**
	 * @param password the password to set
	 */
	public void setDbPassword(String password) {
		this.dbPassword = password;
	}
	/**
	 * @param dbPropertyDefinitionUrl the dbPropertyDefinitionUrl to set
	 */
	public void setDbPropertyDefinitionUrl(String dbPropertyDefinitionUrl) {
		this.dbPropertyDefinitionUrl = dbPropertyDefinitionUrl;
	}
	/**
	 * @param dbRepositoriesUrl the dbRepositoriesUrl to set
	 */
	public void setDbRepositoriesUrl(String dbRepositoriesUrl) {
		this.dbRepositoriesUrl = dbRepositoriesUrl;
	}
	/**
	 * @param dbRepositoryByIdUrl the dbRepositoryByIdUrl to set
	 */
	public void setDbRepositoryByIdUrl(String dbRepositoryByIdUrl) {
		this.dbRepositoryByIdUrl = dbRepositoryByIdUrl;
	}
	/**
	 * @param dbRepositoryCapabilitiesUrl the dbRepositoryCapabilitiesUrl to set
	 */
	public void setDbRepositoryCapabilitiesUrl(String dbRepositoryCapabilitiesUrl) {
		this.dbRepositoryCapabilitiesUrl = dbRepositoryCapabilitiesUrl;
	}
	/**
	 * @param dbRepositoryUrl the dbRepositoryUrl to set
	 */
	public void setDbRepositoryUrl(String dbRepositoryUrl) {
		this.dbRepositoryUrl = dbRepositoryUrl;
	}
	
	/**
	 * @param dbTypeChildrenUrl the dbTypeChildrenUrl to set
	 */
	public void setDbTypeChildrenUrl(String dbTypeChildrenUrl) {
		this.dbTypeChildrenUrl = dbTypeChildrenUrl;
	}
	/**
	 * @param username the username to set
	 */
	public void setDbUsername(String username) {
		this.dbUsername = username;
	}
	/**
	 * @param dbUserUrl the dbUserUrl to set
	 */
	public void setDbUserUrl(String dbUserUrl) {
		this.dbUserUrl = dbUserUrl;
	}
	/**
	 * @param driverClassName the driverClassName to set
	 */
	public void setDriverClassName(String driverClassName) {
		this.driverClassName = driverClassName;
	}
	/**
	 * @param inputConfigUrl the inputConfigUrl to set
	 */
	public void setInputConfigUrl(String inputConfigUrl) {
		this.inputConfigUrl = inputConfigUrl;
	}
	/**
	 * @param inputCurrentUserUrl the inputCurrentUserUrl to set
	 */
	public void setInputCurrentUserUrl(String inputCurrentUserUrl) {
		this.inputCurrentUserUrl = inputCurrentUserUrl;
	}
	/**
	 * @param inputDownloadObjectUrl the inputDownloadObjectUrl to set
	 */
	public void setInputDownloadObjectUrl(String inputDownloadObjectUrl) {
		this.inputDownloadObjectUrl = inputDownloadObjectUrl;
	}
	/**
	 * @param dbObjectTypeUrl the dbObjectTypeUrl to set
	 */
	public void setInputObjectTypeUrl(String inputObjectTypeUrl) {
		this.inputObjectTypeUrl = inputObjectTypeUrl;
	}


	/**
	 * @param inputObjectUrl the inputObjectUrl to set
	 */
	public void setInputObjectUrl(String inputObjectUrl) {
		this.inputObjectUrl = inputObjectUrl;
	}
	/**
	 * @param inputRepositoryUrl the inputRepositoryUrl to set
	 */
	public void setInputRepositoryUrl(String inputRepositoryUrl) {
		this.inputRepositoryUrl = inputRepositoryUrl;
	}
	/**
	 * @param inputUploadObjectUrl the inputUploadObjectUrl to set
	 */
	public void setInputUploadObjectUrl(String inputUploadObjectUrl) {
		this.inputUploadObjectUrl = inputUploadObjectUrl;
	}
	/**
	 * @param libreECMConfiguratorLocalPort the libreECMConfiguratorLocalPort to set
	 */
	@SuppressWarnings("static-access")
	public void setLibreECMConfiguratorLocalPort(Integer libreECMConfiguratorLocalPort) {
		this.libreECMConfiguratorLocalPort = libreECMConfiguratorLocalPort;
	}
	/**
	 * @param libreECMDDBBLocalPort the libreECMDDBBLocalPort to set
	 */
	@SuppressWarnings("static-access")
	public void setLibreECMDDBBLocalPort(Integer libreECMDDBBLocalPort) {
		this.libreECMDDBBLocalPort = libreECMDDBBLocalPort;
	}
	/**
	 * @param libreECMInputLocalPort the libreECMInputLocalPort to set
	 */
	@SuppressWarnings("static-access")
	public void setLibreECMInputLocalPort(Integer libreECMInputLocalPort) {
		this.libreECMInputLocalPort = libreECMInputLocalPort;
	}
	/**
	 * @param libreECMLocalPort the libreECMLocalPort to set
	 */
	@SuppressWarnings("static-access")
	public void setLibreECMLocalPort(Integer libreECMLocalPort) {
		this.libreECMLocalPort = libreECMLocalPort;
	}
	/**
	 * @param libreECMOpenCMISLocalPort the libreECMOpenCMISLocalPort to set
	 */
	@SuppressWarnings("static-access")
	public void setLibreECMOpenCMISLocalPort(Integer libreECMOpenCMISLocalPort) {
		this.libreECMOpenCMISLocalPort = libreECMOpenCMISLocalPort;
	}
	/**
	 * @param mainConfigUrl the mainConfigUrl to set
	 */
	public void setMainConfigUrl(String mainConfigUrl) {
		this.mainConfigUrl = mainConfigUrl;
	}
	/**
	 * @param mainCurrentUserUrl the mainCurrentUserUrl to set
	 */
	public void setMainCurrentUserUrl(String mainCurrentUserUrl) {
		this.mainCurrentUserUrl = mainCurrentUserUrl;
	}
	/**
	 * @param mainNewTypeSettableAttributesUrl the mainNewTypeSettableAttributesUrl to set
	 */
	public void setMainNewTypeSettableAttributesUrl(String mainNewTypeSettableAttributesUrl) {
		this.mainNewTypeSettableAttributesUrl = mainNewTypeSettableAttributesUrl;
	}
	/**
	 * @param mainObjectsInFolderUrl the mainObjectsInFolderUrl to set
	 */
	public void setMainObjectsInFolderUrl(String mainObjectsInFolderUrl) {
		this.mainObjectsInFolderUrl = mainObjectsInFolderUrl;
	}
	/**
	 * @param mainObjectTypeUrl the mainObjectTypeUrl to set
	 */
	public void setMainObjectTypeUrl(String mainObjectTypeUrl) {
		this.mainObjectTypeUrl = mainObjectTypeUrl;
	}
	/**
	 * @param mainObjectUrl the mainObjectUrl to set
	 */
	public void setMainObjectUrl(String mainObjectUrl) {
		this.mainObjectUrl = mainObjectUrl;
	}
	/**
	 * @param mainPropertyDefinitionUrl the mainPropertyDefinitionUrl to set
	 */
	public void setMainPropertyDefinitionUrl(String mainPropertyDefinitionUrl) {
		this.mainPropertyDefinitionUrl = mainPropertyDefinitionUrl;
	}
	/**
	 * @param mainRepositoriesUrl the mainRepositoriesUrl to set
	 */
	public void setMainRepositoriesUrl(String mainRepositoriesUrl) {
		this.mainRepositoriesUrl = mainRepositoriesUrl;
	}
	/**
	 * @param mainRepositoryByIdUrl the mainRepositoryByIdUrl to set
	 */
	public void setMainRepositoryByIdUrl(String mainRepositoryByIdUrl) {
		this.mainRepositoryByIdUrl = mainRepositoryByIdUrl;
	}
	/**
	 * @param mainRepositoryUrl the mainRepositoryUrl to set
	 */
	public void setMainRepositoryUrl(String mainRepositoryUrl) {
		this.mainRepositoryUrl = mainRepositoryUrl;
	}
	/**
	 * @param mainTypeChildrenUrl the mainTypeChildrenUrl to set
	 */
	public void setMainTypeChildrenUrl(String mainTypeChildrenUrl) {
		this.mainTypeChildrenUrl = mainTypeChildrenUrl;
	}
	/**
	 * @param mainUserUrl the mainUserUrl to set
	 */
	public void setMainUserUrl(String mainUserUrl) {
		this.mainUserUrl = mainUserUrl;
	}
	/**
	 * @param repositories the repositories to set
	 */
	public void setRepositories(ArrayList<String> repositories) {
		this.repositories = repositories;
	}
}