#ifndef TYPETRANS_H
#define TYPETRANS_H

#include <jsoncpp/json/json.h>

#include <ctime>
#include <list>
#include <map>
#include <typeinfo>
#include <variant>
#include <vector>

#include "dialoguemessage.h"

namespace TypeTrans {
DialogueData::APINameSearchResult findAPIName(const std::string &searchText, Json::Value &apiName,
                                              const std::string &attachmentType);

std::string getProjectRootPath(std::string &filePath);

std::string getTimeStr();

Json::Value dictToJsonValue(const std::vector<std::map<std::string, std::string>> &dict);

std::list<std::string> jsonArrayToStdList(const Json::Value &jsonArray);

Json::Value systemResponseToJsonValue(const std::variant<std::string, std::list<std::string>> &system_response);

Json::Value slotToJsonValue(const std::vector<DialogueData::Slot> &slot);

std::string jsonValueToString(const Json::Value &value);

std::list<std::string> findElementContainingString(const std::vector<std::string> &myList,
                                                   const std::string &targetString);

std::string checkList(const std::list<std::string> &myList);

bool isStringInList(const std::list<std::string> &myList, const std::string &targetString);
Json::Value callSuccessIdentifierToJson(const DialogueData::CallSuccessIdentifier &identifier);

bool checkString(const std::string &str);

bool checkAndSetScaling(std::vector<DialogueData::Slot> &inputVector);

std::vector<std::string> readTxtToList(const std::string &readFilePath);

void appendStringToFile(const std::string &appendFilePath, const std::string &str);

bool containsElement(const std::string &targetStr, const std::vector<std::string> &list);
std::string replaceChinesePunctuation(const std::string &input);

bool isStringInJsonArray(const Json::Value &array, const std::string &str);

bool isPureUTF8ChineseText(const std::string &str);

bool isInteger(const std::string &str);

bool isDecimal(const std::string &str);

std::string removeSuffix(const std::string &str);

std::pair<std::string, std::string> isSlotInRange(const std::string &slotStr, const std::string &intent,
                                                  const std::map<std::string, std::pair<int, int>> &integerScenarios_);

std::pair<std::string, std::string> isSlotInDecimalRange(
    const std::string &slotStr, const std::string &intent,
    const std::map<std::string, std::pair<int, int>> &decimalScenariosScope,
    const std::map<std::string, std::pair<int, int>> &integerScenariosScope);

int countEnglishChars(const std::string &str);

}  // namespace TypeTrans
#endif  // TYPETRANS_H
