package fr.icl.picsel20.user.store;

import java.util.ArrayList;

import org.wso2.carbon.user.api.Property;
import org.wso2.carbon.user.core.UserStoreConfigConstants;

public class CustomUserStoreProperties {

	public static final ArrayList<Property> MANDATORY_PROPERTIES = new ArrayList<Property>();
	public static final ArrayList<Property> OPTIONAL_PROPERTIES = new ArrayList<Property>();
	public static final ArrayList<Property> ADVANCED_PROPERTIES = new ArrayList<Property>();

	static {

		setMandatoryProperty("Empty", "", "Empty");
		

		setProperty(UserStoreConfigConstants.disabled, "false", UserStoreConfigConstants.disabledDescription);

		setProperty("ReadOnly", "true",
				"Indicates whether the user store of this realm operates in the user read only mode or not");
		setProperty(UserStoreConfigConstants.SCIMEnabled, "false", UserStoreConfigConstants.SCIMEnabledDescription);

		// NOTE: If no advanced properties are set, a NPE occurs when trying to modify
		// the settings of the user store via the UI...
		setAdvancedProperty(UserStoreConfigConstants.readGroups, "true",
				"Enable to read external roles provided by the user store");

	}

	private static void setProperty(String name, String value, String description) {
		Property property = new Property(name, value, description, null);
		OPTIONAL_PROPERTIES.add(property);

	}

	private static void setMandatoryProperty(String name, String value, String description) {
		Property property = new Property(name, value, description, null);
		MANDATORY_PROPERTIES.add(property);

	}

	private static void setAdvancedProperty(String name, String value, String description) {
		Property property = new Property(name, value, description, null);
		ADVANCED_PROPERTIES.add(property);
	}

}
