package de.christinecoenen.code.zapp.app.mediathek.api.request;


import android.text.TextUtils;

import androidx.annotation.NonNull;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings({"unused", "UnusedReturnValue"})
public class QueryRequest implements Serializable {

	private final List<Query> queries = new ArrayList<>();

	private String sortBy = "timestamp";
	private String sortOrder = "desc";

	@SuppressWarnings("FieldCanBeLocal")
	private final boolean future = false;
	private int offset = 0;
	private int size = 30;

	public QueryRequest setSimpleSearch(String queryString) {
		this.queries.clear();
		if (!TextUtils.isEmpty(queryString)) {
			this.queries.add(new Query(queryString, "title", "topic"));
		}
		return this;
	}

	public QueryRequest addQuery(String fieldName, String queryString) {
		this.queries.add(new Query(queryString, fieldName));
		return this;
	}

	public QueryRequest setSortBy(String sortBy) {
		this.sortBy = sortBy;
		return this;
	}

	public QueryRequest setSortOrder(String sortOrder) {
		this.sortOrder = sortOrder;
		return this;
	}

	public QueryRequest setOffset(int offset) {
		this.offset = offset;
		return this;
	}

	public QueryRequest setSize(int size) {
		this.size = size;
		return this;
	}

	@NonNull
	@Override
	public String toString() {
		return "QueryRequest{" +
			"queries=" + queries +
			", sortBy='" + sortBy + '\'' +
			", sortOrder='" + sortOrder + '\'' +
			", future=" + future +
			", offset=" + offset +
			", size=" + size +
			'}';
	}
}

@@ -318,35 +318,404 @@
 %7B%0A%0A%09
-private final List%3CQuery%3E q
+@SuppressWarnings(%22FieldCanBeLocal%22)%0A%09private final String%5B%5D ALLOWED_CHANNELS = new String%5B%5D%7B%0A%09%09%22ARD%22,%0A%09%09%22ZDF%22,%0A%09%09%22SWR%22,%0A%09%09%22NDR%22,%0A%09%09%22BR%22,%0A%09%09%22ARTE.DE%22,%0A%09%09%22DW%22,%0A%09%09%223Sat%22,%0A%09%09%22SRF%22,%0A%09%09%22MDR%22,%0A%09%09%22SR%22,%0A%09%09%22KiKA%22,%0A%09%09%22HR%22,%0A%09%09%22RBB%22,%0A%09%09%22ORF%22,%0A%09%09%22WDR%22,%0A%09%09%22rbtv%22,%0A%09%09%22PHOENIX%22,%0A%09%09%22ZDF-tivi%22,%0A%09%09%22SRF.Podcast%22%0A%09%7D;%0A%0A%09private final List%3CQuery%3E queries = new ArrayList%3C%3E();%0A%09private final List%3CQuery%3E alowedChannelsQ
 ueri
@@ -941,16 +941,192 @@
  = 30;%0A%0A
+%09public QueryRequest() %7B%0A%09%09for (String allowedChannel : ALLOWED_CHANNELS) %7B%0A%09%09%09this.alowedChannelsQueries.add(new Query(allowedChannel, %22channel%22));%0A%09%09%7D%0A%0A%09%09ResetQueries();%0A%09%7D%0A%0A
 %09public 
@@ -1182,30 +1182,25 @@
 %7B%0A%09%09
-this.queries.clear
+ResetQueries
 ();%0A
+%0A
 %09%09if
@@ -1809,16 +1809,16 @@
 = size;%0A
-
 %09%09return
@@ -1828,16 +1828,121 @@
 is;%0A%09%7D%0A%0A
+%09private void ResetQueries() %7B%0A%09%09this.queries.clear();%0A%09%09this.queries.addAll(alowedChannelsQueries);%0A%09%7D%0A%0A
 %09@NonNul

Exclude ARTE.FR completely