/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.resource;

import lombok.Data;

import java.io.Serializable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

@Data
public class ResourceType implements Serializable {

    private static final long serialVersionUID = 5840146896341397940L;

    public static final ResourceType CONTENT = new ResourceType("content");
    public static final ResourceType CONNECTOR = new ResourceType("connector");
    public static final ResourceType QUERY_PROFILE = new ResourceType("query_profile");

    private final String name;

    public ResourceType(final String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    public static Set<ResourceType> allOf() {
        return new HashSet<>(Arrays.asList(
            CONTENT,
            CONNECTOR,
            QUERY_PROFILE
        ));
    }

    public static Set<ResourceType> complementOf(final Set<ResourceType> resourceTypes) {
        final Set<ResourceType> set = allOf();

        set.removeAll(resourceTypes);

        return resourceTypes;
    }

    public static Set<ResourceType> of(final ResourceType first, final ResourceType... rest) {
        final Set<ResourceType> set = new HashSet<>();
        set.add(first);
        set.addAll(Arrays.asList(rest));

        return set;
    }

}

@@ -351,16 +351,83 @@
 l.Set;%0A%0A
+/**%0A * Represents the type of a resource in HP Haven OnDemand.%0A */%0A
 @Data%0Apu
@@ -549,16 +549,73 @@
 7940L;%0A%0A
+    /**%0A     * The resource type of a text index%0A     */%0A
     publ
@@ -681,16 +681,73 @@
 ntent%22);
+%0A%0A    /**%0A     * The resource type of a connector%0A     */
 %0A    pub
@@ -818,16 +818,77 @@
 ector%22);
+%0A%0A    /**%0A     * The resource type of a query profile%0A     */
 %0A    pub
@@ -1001,16 +1001,238 @@
  name;%0A%0A
+    /**%0A     * Creates a new resource type with the given name. The static fields declared on this class should be used in%0A     * preference to this where possible.%0A     * @param name The name of the resource type%0A     */%0A
     publ
@@ -1366,32 +1366,137 @@
 rn name;%0A    %7D%0A%0A
+    /**%0A     * @return A set containing all the ResourceType instances declared in static fields%0A     */%0A
     public stati
@@ -1650,32 +1650,33 @@
      ));%0A    %7D%0A%0A
+%0A
     public stati
@@ -1869,24 +1869,260 @@
 pes;%0A    %7D%0A%0A
+    /**%0A     * Returns a set containing the given resource types%0A     * @param first The first resource type to add%0A     * @param rest The remaining resource types to add%0A     * @return A set containing the given resource types%0A     */%0A
     public s

Add documentation