package io.citrine.jcc.query;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import io.citrine.jcc.util.ListUtil;

import java.util.List;

/**
 * Grouping of one or more filters that apply to a field.
 *
 * @author Kyle Michel
 */
public class FilterGroup implements HasLogic {

    @Override
    @JsonSetter("logic")
    public FilterGroup logic(final Logic logic) {
        this.logic = logic;
        return this;
    }

    @Override
    @JsonGetter("logic")
    public Logic logic() {
        return this.logic;
    }

    /**
     * Set the list of filters that apply to the field.
     *
     * @param filter List of {@link Filter} objects.
     * @return This object.
     */
    @JsonSetter("filter")
    private FilterGroup filter(final List<Filter> filter) {
        this.filter = ListUtil.add(filter, this.filter);
        return this;
    }

    /**
     * Add to the list of filters.
     *
     * @param filter {@link Filter} object to add.
     * @return This object.
     */
    @JsonIgnore
    public FilterGroup filter(final Filter filter) {
        this.filter = ListUtil.add(filter, this.filter);
        return this;
    }

    /**
     * Get an iterable over the list of filters.
     *
     * @return Iterable of {@link Filter} objects.
     */
    @JsonGetter("filter")
    public Iterable<Filter> filter() {
        return ListUtil.iterable(this.filter);
    }

    /**
     * Get whether any filters have been applied.
     *
     * @return True if there are any filters.
     */
    @JsonIgnore
    public boolean hasFilter() {
        return ListUtil.hasContent(this.filter);
    }

    /** Logic that the list of filters gets wrapped in. */
    private Logic logic;

    /** List of filters that apply to a field. */
    private List<Filter> filter;
}
@@ -363,274 +363,9 @@
 oup 
-implements HasLogic %7B%0A%0A    @Override%0A    @JsonSetter(%22logic%22)%0A    public FilterGroup logic(final Logic logic) %7B%0A        this.logic = logic;%0A        return this;%0A    %7D%0A%0A    @Override%0A    @JsonGetter(%22logic%22)%0A    public Logic logic() %7B%0A        return this.logic;%0A    %7D
+%7B
 %0A%0A  
@@ -1454,93 +1454,8 @@
  %7D%0A%0A
-    /** Logic that the list of filters gets wrapped in. */%0A    private Logic logic;%0A%0A
     

remove logic from filter group