/*
 * Copyright 2013-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.cloudfoundry.client.v2.applications;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Singular;
import lombok.ToString;
import org.cloudfoundry.client.Validatable;
import org.cloudfoundry.client.ValidationResult;
import org.cloudfoundry.client.v2.InFilterParameter;
import org.cloudfoundry.client.v2.IsFilterParameter;
import org.cloudfoundry.client.v2.PaginatedRequest;

import java.util.List;

/**
 * The request payload for the List all Routes for the Application operation
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public final class ListApplicationRoutesRequest extends PaginatedRequest implements Validatable {

    /**
     * The domain ids
     *
     * @param domainIds the domain ids
     * @return the domain ids
     */
    @Getter(onMethod = @__(@InFilterParameter("domain_guid")))
    private final List<String> domainIds;

    /**
     * The hosts
     *
     * @param hosts the hosts
     * @return the hosts
     */
    @Getter(onMethod = @__(@InFilterParameter("host")))
    private final List<String> hosts;

    /**
     * The id
     *
     * @param id the id
     * @return the id
     */
    @Getter(onMethod = @__(@JsonIgnore))
    private final String id;

    /**
     * The organization ids
     *
     * @param organizationIds the organization ids
     * @return the organization ids
     */
    @Getter(onMethod = @__(@InFilterParameter("organization_guid")))
    private final List<String> organizationIds;

    /**
     * The paths
     *
     * @param paths the paths
     * @return the paths
     */
    @Getter(onMethod = @__(@InFilterParameter("path")))
    private final List<String> paths;

    @Builder
    ListApplicationRoutesRequest(OrderDirection orderDirection, Integer page, Integer resultsPerPage,
                                 @Singular List<String> domainIds,
                                 String id,
                                 @Singular List<String> hosts,
                                 @Singular List<String> organizationIds,
                                 @Singular List<String> paths) {
        super(orderDirection, page, resultsPerPage);
        this.domainIds = domainIds;
        this.id = id;
        this.hosts = hosts;
        this.organizationIds = organizationIds;
        this.paths = paths;
    }

    @Override
    public ValidationResult isValid() {
        ValidationResult.ValidationResultBuilder builder = ValidationResult.builder();

        if (this.id == null) {
            builder.message("id must be specified");
        }

        return builder.build();
    }

}

@@ -1013,61 +1013,8 @@
 er;%0A
-import org.cloudfoundry.client.v2.IsFilterParameter;%0A
 impo
@@ -2347,24 +2347,214 @@
 ng%3E paths;%0A%0A
+    /**%0A     * The ports%0A     *%0A     * @param paths the ports%0A     * @return the ports%0A     */%0A    @Getter(onMethod = @__(@InFilterParameter(%22port%22)))%0A    private final List%3CString%3E ports;%0A%0A
     @Builder
@@ -2554,16 +2554,16 @@
 Builder%0A
-
     List
@@ -2964,16 +2964,79 @@
 g%3E paths
+,%0A                                 @Singular List%3CString%3E ports
 ) %7B%0A    
@@ -3214,24 +3214,24 @@
 izationIds;%0A
-
         this
@@ -3246,16 +3246,44 @@
  paths;%0A
+        this.ports = ports;%0A
     %7D%0A%0A 

Add Port to ListApplicationRoutesRequest