package com.docus.server.message.config;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.docus.core.util.Func;
import com.docus.server.message.util.TableJsonRead;
import lombok.Data;

import java.util.List;
import java.util.Objects;

/**
 * @author wyb
 */
public class QueryConfig {
    private final static String CONFIG_FILE_PATH = "data-config";
    private final static String CONFIG_FILE_NAME = "query-config.json";

    public static Config getConfig() {
        TableJsonRead jsonReader = new TableJsonRead();
        String configJson = jsonReader.ReadContent(CONFIG_FILE_PATH, CONFIG_FILE_NAME);
        System.out.println(configJson);
        if (configJson == null) {
            return null;
        }
        Config config = JSON.parseObject(configJson, Config.class);
        if (Func.isEmpty(config)) {
            return null;
        }
        return config;
    }

    @Data
    public static class Config {
        private String disDates;
        private String disDatee;
        private String downPath;
        private String url;
        private String targetNamespace;
        private String method;
        private List<JSONObject> params;
    }

    public static void main(String[] args)
    {
        Config taskConfig = getConfig();
        System.out.println(taskConfig);
    }
}
