/*
 * Copyright 2015-2020 OpenCB
 *
 * 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.opencb.cellbase.core.api.query;

import java.util.List;

public class CellBaseQueryOptions extends ProjectionQueryOptions {

    @QueryParameter(id = "limit", min = "0")
    protected Integer limit;

    @QueryParameter(id = "skip", min = "0")
    protected Integer skip;

    @QueryParameter(id = "count")
    protected Boolean count = false;

    @QueryParameter(id = "sort")
    protected String sort;

    @QueryParameter(id = "order", dependsOn = "sort", allowedValues = {"ASCENDING", "DESCENDING"})
    protected Order order;

    @QueryParameter(id = "facet")
    protected String facet;

    @QueryParameter(id = "dataRelease")
    protected int dataRelease;

    public enum Order {
        ASCENDING,
        DESCENDING
    }

    public CellBaseQueryOptions() {
    }

    public CellBaseQueryOptions(Integer limit, Integer skip, Boolean count, String sort, Order order, String facet, int dataRelease) {
        this.limit = limit;
        this.skip = skip;
        this.count = count;
        this.sort = sort;
        this.order = order;
        this.facet = facet;
        this.dataRelease = dataRelease;
    }

    public CellBaseQueryOptions(Integer limit, Integer skip, Boolean count, String sort, Order order, String facet, int dataRelease,
                                List<String> includes, List<String> excludes) {
        super(includes, excludes);

        this.limit = limit;
        this.skip = skip;
        this.count = count;
        this.sort = sort;
        this.order = order;
        this.facet = facet;
        this.dataRelease = dataRelease;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("QueryOptions{");
        sb.append("limit=").append(limit);
        sb.append(", skip=").append(skip);
        sb.append(", count=").append(count);
        sb.append(", sort=").append(sort);
        sb.append(", order=").append(order);
        sb.append(", facet=").append(facet);
        sb.append(", dataRelease=").append(dataRelease);
        sb.append(", includes=").append(includes);
        sb.append(", excludes=").append(excludes);
        sb.append('}');
        return sb.toString();
    }

    public Integer getLimit() {
        return limit;
    }

    public CellBaseQueryOptions setLimit(Integer limit) {
        this.limit = limit;
        return this;
    }

    public Integer getSkip() {
        return skip;
    }

    public CellBaseQueryOptions setSkip(Integer skip) {
        this.skip = skip;
        return this;
    }

    public Boolean getCount() {
        return count;
    }

    public CellBaseQueryOptions setCount(Boolean count) {
        this.count = count;
        return this;
    }

    public String getSort() {
        return sort;
    }

    public CellBaseQueryOptions setSort(String sort) {
        this.sort = sort;
        return this;
    }

    public Order getOrder() {
        return order;
    }

    public CellBaseQueryOptions setOrder(Order order) {
        this.order = order;
        return this;
    }

    public String getFacet() {
        return facet;
    }

    public CellBaseQueryOptions setFacet(String facet) {
        this.facet = facet;
        return this;
    }

    public int getDataRelease() {
        return dataRelease;
    }

    public CellBaseQueryOptions setDataRelease(int dataRelease) {
        this.dataRelease = dataRelease;
        return this;
    }
}

@@ -1201,80 +1201,8 @@
 t;%0A%0A
-    @QueryParameter(id = %22dataRelease%22)%0A    protected int dataRelease;%0A%0A
     
@@ -1423,33 +1423,16 @@
 ng facet
-, int dataRelease
 ) %7B%0A    
@@ -1595,48 +1595,8 @@
 et;%0A
-        this.dataRelease = dataRelease;%0A
     
@@ -1714,31 +1714,37 @@
  facet, 
-int dataRelease
+List%3CString%3E includes
 ,%0A      
@@ -1768,39 +1768,16 @@
         
- 
-List%3CString%3E includes,
  List%3CSt
@@ -1998,48 +1998,8 @@
 et;%0A
-        this.dataRelease = dataRelease;%0A
     
@@ -2383,65 +2383,8 @@
 t);%0A
-        sb.append(%22, dataRelease=%22).append(dataRelease);%0A
     
@@ -3574,210 +3574,7 @@
    %7D
-%0A%0A    public int getDataRelease() %7B%0A        return dataRelease;%0A    %7D%0A%0A    public CellBaseQueryOptions setDataRelease(int dataRelease) %7B%0A        this.dataRelease = dataRelease;%0A        return this;%0A    %7D
 %0A%7D%0A

remove 'dataRelease' from QueryOptions, #TASK-596