//deployer SLmanager implementation
// Copyright (C) 2024 Jean-Cloud
// GNU General Public License v3

#include <iostream>
#include <cstring>
#include <vector>
#include <list>
#include "Service.h"

using namespace std;

//constructor and destructor inlin

//services
vector<Service> GetServices() const;
const Service * FindServiceByUsername(string aUsername) const;
const Service * FindServiceByID(int aUserID) const;
//list<const Service*> FindServicesByServer(string aServer) const;
int isServiceOnServer(string serviceUsername);

vector <Service> services;



//int isServiceOnServer(string serviceUsername)
//this method tests if a certain service is on the current server
//it looks into the /etc/hosts file thanks to a pipe to a separate bash process
// {   
//     string cmd ="getent hosts " +serviceUsername;  
//     string result = BashManager::ExecuteAndReadResult(cmd);
//     if(result.find("::1")!=string::npos){ //if result contains "::1" which is the notation for loopback in IpV6
//         cout << "service " << serviceUsername << " on server" << endl;
//         return 0;
//     }
//     cout << "service" << serviceUsername << " not on server" << endl;
//     return 1;
//    return 0;
// }