/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * 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 io.gravitee.repository.management.api.search;

import java.util.Collection;

/**
 * @author David BRASSELY (david.brassely at graviteesource.com)
 * @author GraviteeSource Team
 */
public class ApiKeyCriteria {

    private final Collection<String> plans;

    private final long from, to;

    private final boolean includeRevoked;

    ApiKeyCriteria(ApiKeyCriteria.Builder builder) {
        this.from = builder.from;
        this.to = builder.to;
        this.plans = builder.plans;
        this.includeRevoked = builder.includeRevoked;
    }

    public Collection<String> getPlans() {
        return plans;
    }

    public long getFrom() {
        return from;
    }

    public long getTo() {
        return to;
    }

    public boolean isIncludeRevoked() {
        return includeRevoked;
    }

    public static class Builder {
        private Collection<String> plans;

        private long from, to;

        private boolean includeRevoked;

        public ApiKeyCriteria.Builder from(long from) {
            this.from = from;
            return this;
        }

        public ApiKeyCriteria.Builder to(long to) {
            this.to = to;
            return this;
        }

        public ApiKeyCriteria.Builder plans(Collection<String> plans) {
            this.plans = plans;
            return this;
        }

        public ApiKeyCriteria.Builder includeRevoked(boolean include) {
            this.includeRevoked = include;
            return this;
        }

        public ApiKeyCriteria build() {
            return new ApiKeyCriteria(this);
        }
    }
}

@@ -962,24 +962,75 @@
 deRevoked;%0A%0A
+    private final long expireAfter, expireBefore;%0A%0A
     ApiKeyCr
@@ -1066,24 +1066,24 @@
  builder) %7B%0A
-
         this
@@ -1216,32 +1216,130 @@
 includeRevoked;%0A
+        this.expireAfter = builder.expireAfter;%0A        this.expireBefore = builder.expireBefore;%0A
     %7D%0A%0A    publi
@@ -1579,32 +1579,174 @@
 Revoked;%0A    %7D%0A%0A
+    public long getExpireAfter() %7B%0A        return expireAfter;%0A    %7D%0A%0A    public long getExpireBefore() %7B%0A        return expireBefore;%0A    %7D%0A%0A
     public stati
@@ -1875,24 +1875,73 @@
 deRevoked;%0A%0A
+        private long expireAfter, expireBefore;%0A%0A
         publ
@@ -2372,24 +2372,24 @@
  include) %7B%0A
-
             
@@ -2447,32 +2447,344 @@
 his;%0A        %7D%0A%0A
+        public ApiKeyCriteria.Builder expireAfter(long expireAtAfter) %7B%0A            this.expireAfter = expireAtAfter;%0A            return this;%0A        %7D%0A%0A        public ApiKeyCriteria.Builder expireBefore(long expireAtBefore) %7B%0A            this.expireBefore = expireAtBefore;%0A            return this;%0A        %7D%0A%0A
         public A

add fields to filter by expiration date in ApiKeyCriteria