package de.thpeetz.kontor.common.views;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@ToString
public class SearchFilter {

    @Getter
    @Setter
    private String searchTerm;

    @Getter
    private List<FilterOption> filterOptions = new LinkedList<>();

    private final Map<String, FilterOption> filterMap = new HashMap<>();

    public SearchFilter() {

    }

    public void addFilter(FilterOption option) {
        filterOptions.add(option);
        filterMap.put(option.getName(), option);
    }

    public FilterOption getFilter(String optionName) {
        return filterMap.get(optionName);
    }
}
