/**
 * Copyright 2019 interactive instruments GmbH
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package de.ii.ldproxy.wfs3.aroundrelations;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.collect.ImmutableList;
import de.ii.ldproxy.ogcapi.domain.ExtensionConfiguration;
import org.immutables.value.Value;

import java.util.List;
import java.util.OptionalDouble;

/**
 * @author zahnen
 */
@Value.Immutable
@Value.Modifiable
@Value.Style(builder = "new")
@JsonDeserialize(as = ModifiableAroundRelationsConfiguration.class)
public abstract class AroundRelationsConfiguration implements ExtensionConfiguration {

    @Value.Default
    @Override
    public boolean getEnabled() {
        return false;
    }

    @Value.Default
    public List<Relation> getRelations() { return ImmutableList.of(); };

    @Value.Immutable
    @Value.Modifiable
    @JsonDeserialize(as = ModifiableRelation.class)
    public static abstract class Relation {

        public abstract String getId();

        public abstract String getLabel();

        public abstract String getResponseType();

        public abstract String getUrlTemplate();

        public abstract OptionalDouble getBufferInMeters();
    }

    @Override
    public ExtensionConfiguration mergeDefaults(ExtensionConfiguration extensionConfigurationDefault) {
        return new ImmutableAroundRelationsConfiguration.Builder()
                                                    .from(extensionConfigurationDefault)
                                                    .from(this)
                                                    .build();
    }

}

@@ -298,16 +298,119 @@
 tions;%0A%0A
+import com.fasterxml.jackson.annotation.JsonMerge;%0Aimport com.fasterxml.jackson.annotation.OptBoolean;%0A
 import c
@@ -467,16 +467,16 @@
 ialize;%0A
-
 import c
@@ -776,30 +776,29 @@
 ialize(as = 
-Modifi
+Immut
 ableAroundRe
@@ -1005,24 +1005,65 @@
 lse;%0A    %7D%0A%0A
+    @JsonMerge(value = OptBoolean.FALSE)%0A
     @Value.D

fix around relations config