package com.libreecm.db.jpa;

import java.util.Set;

import javax.persistence.ElementCollection;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.apache.chemistry.opencmis.commons.enums.PropertyType;
import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.libreecm.commonAPI.model.LibreECMObject;
import com.libreecm.commonAPI.model.enums.Action;

import java.util.EnumSet;


/**
 * Allowable Actions. 
 */
public class AllowableActions  extends LibreECMObject{

	@Id
	@GeneratedValue(generator="hilo-gen")
	@GenericGenerator(name="hilo-gen", strategy="hilo")
	private Integer id; 
	
	@JsonIgnore
	private static final long serialVersionUID = 1L;


    @ElementCollection(targetClass=Action.class)
    private Set<Action> allowableActions;

    public Set<Action> getAllowableActions() {
        if (allowableActions == null) {
            allowableActions = EnumSet.noneOf(Action.class);
        }

        return allowableActions;
    }

    public void setAllowableActions(Set<Action> allowableActions) {
        this.allowableActions = allowableActions;
    }

    public String toString() {
        return "Allowable Actions [allowable actions=" + allowableActions + "]" + super.toString();
    }
}