package com.microstar.tap3.util;

import java.util.HashMap;
import java.util.Map;

import com.amazonaws.serverless.proxy.internal.model.ApiGatewayAuthorizerContext;

public class ConfigSingleton {

	private static ConfigSingleton instance = null;
	private final HashMap<String, String> properties = new HashMap<>();
	private String identity;
	private ApiGatewayAuthorizerContext authorizer;
	
	public static ConfigSingleton getInstance()
	{
		if ( instance == null )
			instance = new ConfigSingleton();
		
		return instance;
	}
	
	public void addProperty(String key, String value)
	{
		properties.put(key, value);
	}
	
	public String getProperty(String key)
	{
		return properties.get(key);
	}
	
//	public void addAllProperties(Map<String, Object> props)
//	{
//		properties.putAll(props);
//	}

	public void addAllProperties(Map<String, String> props) 
	{
		if ( props != null )
			properties.putAll(props);
	}

	public String getIdentity() {
		return identity;
	}

	public void setIdentity(String identity) {
		this.identity = identity;
	}

	public ApiGatewayAuthorizerContext getAuthorizer() {
		return authorizer;
	}

	public void setAuthorizer(ApiGatewayAuthorizerContext authorizer) {
		this.authorizer = authorizer;
	}
}
