#ifndef __BUILDER_PLATFORM_H__
#define __BUILDER_PLATFORM_H__

#include "KMBuilderCache.h"
#include "KMBuilderConfigTypes.h"
#include "KMBuilderContext.h"
#include "KMBuilderGlobal.h"
#include "KMBuilderUtils.h"
#include "common/KMLogger.h"
#include "tinyxml2.h"

#include <gio/gio.h>
#include <json/json.h>
#include <ostree.h>
#include <yaml-cpp/yaml.h>

#include <algorithm>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <variant>
#include <vector>

using namespace std;

/*
类名: KMBuilderPlatform
功能: 用于生成运行时过程
成员变量:
   - shared_ptr<ConfigData> m_pConfigData;       	        //ConfigData配置文件指针
   - shared_ptr<KMBuilderCache> m_pKMBuilderCache; 	        //KMBuilderCache指针
   - BuilderCache m_builderCache;               	        //BuilderCache结构体
   - KMBuilderModule *m_pBuilderModule; 			        //BuilderModule私有嵌套BuilderModuleData
   - shared_ptr<BuilderModuleData> m_pBuilderModuleData;	//BuilderModuleData指针
成员函数:
   - 省略
*/
class KMBuilderPlatform
{
public:
    KMBuilderPlatform(shared_ptr<KMBuilderCache> cache);
    virtual ~KMBuilderPlatform();

public:
    /**
     * @brief : 开始执行Platform阶段
     * @return: true-成功; false-失败
     */
    bool configCreatePlatform();

    /**
     * @brief : 开始执行PlatformBase阶段
     * @return: true-成功; false-失败
     */
    bool configCreatePlatformBase();
    /**
     * @brief : 开始执行PreparePlatform阶段
     * @return: true-成功; false-失败
     */
    bool configPreparePlatform();
    /**
     * @brief : 开始执行FinishPlatform阶段
     * @return: true-成功; false-失败
     */
    bool configFinishPlatform();
    /**
     * @brief : 执行PlatformBase阶段的checksum
     */
    void configChecksumForPlatformBase();
    /**
     * @brief : 执行PlatformPrepare阶段的checksum
     */
    void configChecksumForPlatformPrepare();
    /**
     * @brief : 执行PlatformFinish阶段的checksum
     */
    void configChecksumForPlatformFinish();
    /**
     * @brief : 执行BundleSources阶段的checksum
     */
    void configChecksumForBundleSources();
    /**
     * @brief : 开始执行BundleSources阶段
     */
    bool configBundleSources();

private:
    shared_ptr<ConfigData> m_pConfigData;               // ConfigData配置文件指针
    shared_ptr<KMBuilderCache> m_pKMBuilderCache;       // KMBuilderCache指针
    BuilderCache m_builderCache;                        // BuilderCache结构体
    KMBuilderModule *m_pBuilderModule;                  // BuilderModule私有嵌套BuilderModuleData
    shared_ptr<BuilderModuleData> m_pBuilderModuleData; // BuilderModuleData指针
};

#endif /* __BUILDER_PLATFORM_H__ */
