#pragma once
#include "kubecontrol/KubernetesAPI.hpp"
#include <cstddef>
#include <kubecontrol/KubePod.hpp>
#include <memory>
#include <mutex>
#include <string>
#include <vector>

namespace kubecontrol
{


    class PodController
    {
        public:
            explicit PodController(std::string pathToKubectlConfig);

            std::string getServerAddress();

            void startPod(KubePod Pod,bool WaitTillRunning = true );
            void startPod(std::shared_ptr<KubePod> Pod,bool WaitTillRunning = true );

            void stopPod(std::string uuid);
            void stopAllPods();

            std::vector<PodInfos> getInfoForAllPods();
            PodInfos getInfoForPod(std::string uuid);

            KubernetesAPI getKubernetesAPI();

        private:
            KubernetesAPI APIInterface_;
            std::vector<std::unique_ptr<KubePod>> PodList_;

            std::string Namespace_;
            std::string ApiCall_;

            PodInfos extractInfosFromKubePod(KubePod *pod);


            mutable std::mutex mx_;

    };
} // namespace ku
