/*
 * Waltz - Enterprise Architecture
 * Copyright (C) 2016, 2017 Waltz open source project
 * See README.md for more information
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.khartec.waltz.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.khartec.waltz.common.SetUtilities;
import org.immutables.value.Value;

import java.util.List;
import java.util.Set;

@Value.Immutable
@JsonSerialize(as = ImmutableIdSelectionOptions.class)
@JsonDeserialize(as = ImmutableIdSelectionOptions.class)
public abstract class IdSelectionOptions {

    public abstract EntityReference entityReference();
    public abstract HierarchyQueryScope scope();

    @Value.Default
    public Set<EntityLifecycleStatus> entityLifecycleStatuses() {
        return SetUtilities.fromArray(EntityLifecycleStatus.ACTIVE);
    }

    public static IdSelectionOptions mkOpts(EntityReference ref, HierarchyQueryScope scope) {
        return ImmutableIdSelectionOptions.builder()
                .entityReference(ref)
                .scope(scope)
                .build();
    }
}

@@ -1065,34 +1065,145 @@
 til.
-List;%0Aimport java.util.Set
+Set;%0A%0Aimport static com.khartec.waltz.model.HierarchyQueryScope.CHILDREN;%0Aimport static com.khartec.waltz.model.HierarchyQueryScope.EXACT
 ;%0A%0A@
@@ -1855,16 +1855,16 @@
 (scope)%0A
-
         
@@ -1877,20 +1877,829 @@
   .build();%0A
+    %7D%0A    %0A    public static IdSelectionOptions mkOpts(EntityReference ref) %7B%0A        return ImmutableIdSelectionOptions.builder()%0A                .entityReference(ref)%0A                .scope(determineDefaultScope(ref.kind()))%0A                .build();%0A    %7D%0A%0A%0A    private static HierarchyQueryScope determineDefaultScope(EntityKind kind) %7B%0A        switch (kind) %7B%0A            case ACTOR:%0A            case APPLICATION:%0A            case APP_GROUP:%0A            case CHANGE_INITIATIVE:%0A            case FLOW_DIAGRAM:%0A            case LOGICAL_DATA_ELEMENT:%0A            case LOGICAL_DATA_FLOW:%0A            case PHYSICAL_FLOW:%0A            case PHYSICAL_SPECIFICATION:%0A            case SCENARIO:%0A            case SERVER:%0A                return EXACT;%0A            default:%0A                return CHILDREN;%0A        %7D%0A%0A
     %7D%0A%7D%0A

Update IdSelectionOptions.java