package com.libreecm.commonAPI.model.objects;

import java.util.ArrayList;
import java.util.List;

import com.libreecm.commonAPI.model.enums.BaseTypeId;
import com.libreecm.commonAPI.model.enums.Cardinality;
import com.libreecm.commonAPI.model.enums.MimeType;
import com.libreecm.commonAPI.model.enums.PropertyType;
import com.libreecm.commonAPI.model.enums.Updatability;
import com.libreecm.commonAPI.model.objects.properties.PropertyBooleanDefinitionImpl;
import com.libreecm.commonAPI.model.objects.properties.PropertyIdDefinitionImpl;
import com.libreecm.commonAPI.model.objects.properties.PropertyStringDefinitionImpl;
import com.libreecm.commonAPI.model.objects.properties.PropertyStringImpl;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;


@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class Folder  extends LibreECMDataObject {

	@JsonIgnore
	private static final long serialVersionUID = -2200886552551156763L;
	/**   
	 * Property showing the object is active for the system.
	 */
	private List<ObjectType> allowedChildObjectTypeIds;
		
	
	/**
	 * Constructor default for this class
	 */
	public Folder(){
		super();
		//For jackson, setObjectType SHOULD be called first
		this.setObjectType(new FolderObjectType());
		this.setBaseTypeId(BaseTypeId.CMIS_FOLDER);
	}
	
	public Folder(Uri uri, ObjectType objectType){
		super(uri, objectType);
	}
		
	/**
	 * @return the allowedChildObjectTypeIds
	 */
	public List<ObjectType> getAllowedChildObjectTypeIds() {
		if (this.allowedChildObjectTypeIds==null)
			return new ArrayList<>();
		return allowedChildObjectTypeIds;
	}
		
	
	/**
	 * @param allowedChildObjectTypeIds the allowedChildObjectTypeIds to set
	 */
	public void setAllowedChildObjectTypeIds(List<ObjectType> allowedChildObjectTypeIds) {
		if (allowedChildObjectTypeIds==null) return;
		List<String> ids=new ArrayList<>();
		for (ObjectType type : allowedChildObjectTypeIds){
			ids.add(type.getId());
		}
		addListStringProperty("cmis:allowedChildObjectTypeIds", ids);
		this.allowedChildObjectTypeIds = allowedChildObjectTypeIds;
	}


}
