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;

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

    public static List<Config> getConfig() {
        TableJsonRead jsonReader = new TableJsonRead();
        String configJson = jsonReader.ReadContent(CONFIG_FILE_PATH, CONFIG_FILE_NAME);
        if (configJson == null) {
            return null;
        }
        List<Config> configs = JSON.parseArray(configJson, Config.class);
        if (Func.isEmpty(configs)) {
            return null;
        }
        return configs;
    }

    @Data
    public static class Config {
        private String emrTypeCode;
        private String assortId;
    }

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