package com.tzld.piaoquan.recommend.server.service.score;

import com.google.gson.Gson;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigObject;
import com.typesafe.config.ConfigValue;

import java.util.Map;
import java.util.Set;


public class ScorerConfigInfo {

    private String configName;
    private Integer scorerPriority;
    private Boolean disableSwitch;
    private String scorerName;
    private Set<String> enableQueues;
    private String modelPath;
    private Config paramConfig; // param config
    private ConfigObject paramMap;

    public ScorerConfigInfo(String configName,
                            String scorerName,
                            Integer scorerPriority,
                            Boolean disableSwitch,
                            Set<String> enableQueues,
                            String modelPath,
                            Config paramConfig,
                            ConfigObject paramMap) {

        this.configName = configName;
        this.scorerName = scorerName;
        this.scorerPriority = scorerPriority;
        this.disableSwitch = disableSwitch;
        this.enableQueues = enableQueues;
        this.modelPath = modelPath;
        this.paramConfig = paramConfig;
        this.paramMap = paramMap;
    }

    public Config getParamConfig() {
        return paramConfig;
    }

    public Set<String> getEnableQueues() {
        return enableQueues;
    }

    public void setEnableQueues(Set<String> enableQueues) {
        this.enableQueues = enableQueues;
    }

    public Integer getScorerPriority() {
        return scorerPriority;
    }

    public String getScorerName() {
        return scorerName;
    }

    public String getConfigName() {
        return configName;
    }

    public boolean isQueueEnable(String queueName) {
        return this.enableQueues == null ||
                this.enableQueues.isEmpty() ||
                this.enableQueues.contains(queueName);
    }

    public String getModelPath() {
        return modelPath;
    }

    public Boolean getDisableSwitch() {
        return disableSwitch;
    }

    public ConfigObject getParamMap(){
        return paramMap;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
