// 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.controller.api.application.v4.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yahoo.vespa.hosted.controller.api.identifiers.GitBranch;
import com.yahoo.vespa.hosted.controller.api.identifiers.GitCommit;
import com.yahoo.vespa.hosted.controller.api.identifiers.GitRepository;
import com.yahoo.vespa.hosted.controller.api.identifiers.RevisionId;
import com.yahoo.vespa.hosted.controller.api.identifiers.ScrewdriverId;

import java.net.URI;
import java.util.List;

/**
 * @author mortent
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class InstanceInformation {
    public List<URI> serviceUrls;
    public List<Endpoint> endpoints;
    public URI nodes;
    public URI yamasUrl;
    public RevisionId revision;
    public Long deployTimeEpochMs;
    public Long expiryTimeEpochMs;

    public ScrewdriverId screwdriverId;
    public GitRepository gitRepository;
    public GitBranch gitBranch;
    public GitCommit gitCommit;

    public static class Endpoint {
        public String cluster;
        public boolean tls;
        public URI url;

        @JsonCreator
        public Endpoint(@JsonProperty("cluster") String cluster ,
                        @JsonProperty("tls") boolean tls,
                        @JsonProperty("url") URI url) {
            this.cluster = cluster;
            this.tls = tls;
            this.url = url;
        }

        @Override
        public String toString() {
            return "Endpoint {" +
                    "cluster=" + cluster+
                    ", tls='" + tls + '\'' +
                    ", url='" + url+ '\'' +
                    '}';
        }
    }
}

@@ -350,16 +350,70 @@
 operty;%0A
+import com.yahoo.config.provision.zone.RoutingMethod;%0A
 import c
@@ -1388,16 +1388,89 @@
 URI url;
+%0A        public String scope;%0A        public RoutingMethod routingMethod;
 %0A%0A      
@@ -1660,16 +1660,161 @@
  URI url
+,%0A                        @JsonProperty(%22scope%22) String scope,%0A                        @JsonProperty(%22routingMethod%22) RoutingMethod routingMethod
 ) %7B%0A    
@@ -1897,24 +1897,104 @@
 .url = url;%0A
+            this.scope = scope;%0A            this.routingMethod = routingMethod;%0A
         %7D%0A%0A 
@@ -2077,15 +2077,13 @@
 oint
- 
 %7B%22 +%0A
- 
     
@@ -2106,16 +2106,17 @@
 cluster=
+'
 %22 + clus
@@ -2118,19 +2118,26 @@
  cluster
+ + '%5C'' 
 +%0A
- 
         
@@ -2154,17 +2154,16 @@
  %22, tls=
-'
 %22 + tls 
@@ -2163,25 +2163,17 @@
  + tls +
- '%5C'' +%0A 
+%0A
         
@@ -2194,26 +2194,122 @@
 url=
-'
 %22 + url
-+ '%5C'' +%0A 
+ +%0A                   %22, scope='%22 + scope + '%5C'' +%0A                   %22, routingMethod=%22 + routingMethod +%0A
     

Add scope and routingMethod