// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.noderepository.bindings;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Collections;
import java.util.List;

/**
 * This class represents a response from the /nodes/v2/acl/ API.
 *
 * @author mpolden
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetAclResponse {

    @JsonProperty("trustedNodes")
    public final List<Node> trustedNodes;

    @JsonCreator
    public GetAclResponse(@JsonProperty("trustedNodes") List<Node> trustedNodes) {
        this.trustedNodes = trustedNodes == null ? Collections.emptyList() : trustedNodes;
    }

    public static class Node {

        @JsonProperty("hostname")
        public final String hostname;

        @JsonProperty("ipAddress")
        public final String ipAddress;

        @JsonProperty("trustedBy")
        public final String trustedBy;

        @JsonCreator
        public Node(@JsonProperty("hostname") String hostname, @JsonProperty("ipAddress") String ipAddress,
                    @JsonProperty("trustedBy") String trustedBy) {
            this.hostname = hostname;
            this.ipAddress = ipAddress;
            this.trustedBy = trustedBy;
        }
    }
}

@@ -647,24 +647,110 @@
 stedNodes;%0A%0A
+    @JsonProperty(%22trustedNetworks%22)%0A    public final List%3CNetwork%3E trustedNetworks;%0A%0A
     @JsonCre
@@ -833,16 +833,106 @@
 tedNodes
+,%0A                          @JsonProperty(%22trustedNetworks%22) List%3CNetwork%3E trustedNetworks
 ) %7B%0A    
@@ -1018,16 +1018,116 @@
 dNodes;%0A
+        this.trustedNetworks = trustedNetworks == null ? Collections.emptyList() : trustedNetworks;%0A
     %7D%0A%0A 
@@ -1709,11 +1709,417 @@
  %7D%0A    %7D
+%0A%0A    public static class Network %7B%0A%0A        @JsonProperty(%22network%22)%0A        public final String network;%0A%0A        @JsonProperty(%22trustedBy%22)%0A        public final String trustedBy;%0A%0A        @JsonCreator%0A        public Network(@JsonProperty(%22network%22) String network, @JsonProperty(%22trustedBy%22) String trustedBy) %7B%0A            this.network = network;%0A            this.trustedBy = trustedBy;%0A        %7D%0A    %7D
 %0A%7D%0A

Update AclResponse in node-admin