/*
 * Copyright 2024 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

#include <iostream>

#include "../src/services/assistant/intentdialoguemanager/systemoperation/systemoperation.h"
void testSystemOperation() {
    SystemOperation systemOperation;
    DialogueData::Intent intent;

    intent.name = "系统操作_设置显示器色温与护眼";
    intent.slots.push_back(DialogueData::Slot({"操作", false, {"打开"}}));
    intent.slots.push_back(DialogueData::Slot({"操作", false, {"打开"}}));
    DialogueData::CallSuccessIdentifier callSuccess =
        systemOperation.callSystemControlInterface(intent);

    if (callSuccess.successRes == true) {
        std::cout << "success" << std::endl;
    } else {
        std::cout << "failed" << std::endl;
        std::cout << callSuccess.errorMessage << std::endl;
        std::cout << callSuccess.errorCode << std::endl;
    }
}

void testScheduleManagement() {
    SystemOperation systemOperation;
    // std::string intent = R"(```json{
    //     "日程主题": "城市智慧交通建设方案研讨",
    //     "日程开始时间": "2025-03-06 19:25",
    //     "日程结束时间": "2025-03-07 21:30"
    // }```)";
    std::string intent = R"("日程主题": "准备开秋季学期教学进度表报告会",
    "日程开始时间": "2025-04-09 09:00",
    "日程结束时间": "2025-04-09 10:00"
})";
    DialogueData::CallSuccessIdentifier callSuccess =
        systemOperation.callSystemScheduleManagementInterface(intent);

    if (callSuccess.successRes == true) {
        std::cout << "success" << std::endl;
    } else {
        std::cout << "failed" << std::endl;
        std::cout << callSuccess.errorMessage << std::endl;
        std::cout << callSuccess.errorCode << std::endl;
    }
}
void testToDoList() {
    SystemOperation systemOperation;
    std::string intent = R"(# 2025年08月01日 星期一
- 完成对老旧城区改造项目中拆迁安置补偿标准的修订工作，并组织相关利益方进行意见征求会。

# 2025年08月02日 星期二
- 审查各部门上半年工作总结报告，提炼重点成果与问题，为政府工作报告撰写积累素材。

# 2025年08月03日 星期三
- 与司法部门联合开展行政执法规范培训课程的筹备工作，确定培训讲师与课程大纲。

# 2025年08月04日 星期四
- 制定关于鼓励创新创业的人才奖励政策执行细则，明确奖励申请流程与审核标准。

# 2025年08月05日 星期五
- 无

# 2025年08月05日 星期五
- 完成对本地历史文化街区保护规划的实地勘察评估，撰写详细的勘察报告。)";
    DialogueData::CallSuccessIdentifier callSuccess =
        systemOperation.callSystemToDoListInterface(intent);

    if (callSuccess.successRes == true) {
        std::cout << "success" << std::endl;
    } else {
        std::cout << "failed" << std::endl;
        std::cout << callSuccess.errorMessage << std::endl;
        std::cout << callSuccess.errorCode << std::endl;
    }
}

void testOpenSchedule() {
    SystemOperation systemOperation;
    std::string intent = "2025-03-10";
    DialogueData::CallSuccessIdentifier callSuccess =systemOperation.callSystemOpenScheduleInterface(intent);
    if (callSuccess.successRes == true) {
        std::cout << "success" << std::endl;
    }
    else {
        std::cout << "failed" << std::endl;
        std::cout << callSuccess.errorMessage << std::endl;
        std::cout << callSuccess.errorCode << std::endl;
    }
}

int main() {
    logger::init();
    // testSystemOperation();
    // testScheduleManagement();
    testToDoList();
    // testOpenSchedule();

    return 0;
}