/* KMBuilderConfigYaml.h
 *
 * Copyright (C) 2023 OpenKylin, Inc
 */

#ifndef __BUILDER_CONFIG_YAML_H__
#define __BUILDER_CONFIG_YAML_H__

#include "KMBuilderConfig.h"

class KMBuilderConfigYaml : public KMBuilderConfig
{
public:
    KMBuilderConfigYaml();
    ~KMBuilderConfigYaml();

    bool loadConfigFile(const string &configFile) final;
    any getAttribute(const string &name) final;

private:
    bool loadBase();
    shared_ptr<KMBuildOptions> getBuildOptions(const YAML::Node &node);
    void loadAddExtensions();
    void loadAddBuildExtensions();
    const shared_ptr<BuilderExtension> getExtension(const YAML::Node &node);
    const vector<shared_ptr<KMBuilderModule>> getNodeModules(const YAML::Node &node);

    const string getString(const YAML::Node &node, const string &key);
    const bool getBool(const YAML::Node &node, const string &key);
    const vector<string> getStringArray(const YAML::Node &node, const string &key);

private:
    YAML::Node m_rootNode;
};

#endif // !__BUILDER_FLOW_H__
