// Copyright 2019 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.integration.configserver;

import com.yahoo.vespa.flags.json.wire.WireFlagData;
import com.yahoo.vespa.flags.json.wire.WireFlagDataList;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

/**
 * @author hakonhall
 */
@Path("")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface FlagsV1Api {
    @PUT
    @Path("/data/{flagId}")
    void putFlagData(@PathParam("flagId") String flagId, @QueryParam("force") Boolean force, WireFlagData flagData);

    @GET
    @Path("/data/{flagId}")
    WireFlagData getFlagData(@PathParam("flagId") String flagId, @QueryParam("force") Boolean force);

    @DELETE
    @Path("/data/{flagId}")
    void deleteFlagData(@PathParam("flagId") String flagId, @QueryParam("force") Boolean force);

    @GET
    @Path("/data")
    WireFlagDataList listFlagData(@QueryParam("recursive") Boolean recursive);
}

@@ -185,16 +185,185 @@
 erver;%0A%0A
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;%0Aimport com.fasterxml.jackson.annotation.JsonInclude;%0Aimport com.fasterxml.jackson.annotation.JsonProperty;%0A
 import c
@@ -407,16 +407,16 @@
 agData;%0A
-
 import c
@@ -718,16 +718,61 @@
 diaType;
+%0Aimport java.util.List;%0Aimport java.util.Map;
 %0A%0A/**%0A *
@@ -1371,16 +1371,16 @@
 /data%22)%0A
-
     Wire
@@ -1449,11 +1449,354 @@
 ursive);
+%0A%0A    @GET%0A    @Path(%22/defined%22)%0A    Map%3CString, WireFlagDefinition%3E listFlagDefinition();%0A%0A    @JsonIgnoreProperties(ignoreUnknown = true)%0A    @JsonInclude(JsonInclude.Include.NON_NULL)%0A    class WireFlagDefinition %7B%0A        @JsonProperty(%22owners%22) public List%3CString%3E owners;%0A        @JsonProperty(%22expiresAt%22) public String expiresAt;%0A    %7D
 %0A%7D%0A

Add jax-rs definition for method listing defined flags