package com.tzld.piaoquan.recommend.server.framework.recaller;


import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.FluentIterable;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Nullable;


public class FilterConfigInfo {
    private Set<Integer> disableExpIds;
    private String filterName;
    private Integer filterPriority;
    private String configName;

    public FilterConfigInfo(String configName,
                            String filterName,
                            Integer filterPriority,
                            List<Integer> expIds) {
        this.configName = configName;
        this.filterName = filterName;
        this.filterPriority = filterPriority;
        this.disableExpIds = new HashSet<Integer>();
        this.disableExpIds.addAll(expIds);
    }

    public Integer getFilterPriority() {
        return filterPriority;
    }

    public String getFilterName() {
        return filterName;
    }

    public Set<Integer> getDisableExpIds() {
        return disableExpIds;
    }

    public String getConfigName() {
        return configName;
    }

    @Override
    public String toString() {
        return configName + ":" + filterPriority + ":" + filterName + ":" +
                Joiner.on(",").join(FluentIterable.from(disableExpIds).transform(new Function<Integer, String>() {
                    @Nullable
                    @Override
                    public String apply(Integer integer) {
                        return integer.toString();
                    }
                }));
    }
}
