#include <cstdlib>
#include <iostream>

#include "../vtapi/include/vtapi_settings.h"
#include "../vtapi/include/vtapi.h"
#include "JSON.h"
#include "JSONValue.h"
#include <time.h>
#include <dirent.h> 



/**
* Velmi velmi VELMI NEEFEKTIVNI zbytecne se prochazi vsechny sequence
**/
bool isIdAvailable(const char * id,Dataset* dataset){
	Sequence* seq=dataset->newSequence();

	while(seq->next()){		
		if(strcmp(id,seq->getName().c_str())==0){			
			return false;
		}
	}	
	return true;
}


/**
* param name
* return id sequence
**/
int main(int argc, char** argv){
	
	VTApi * vtapi = new VTApi(argc, argv);

	Dataset* dataset = vtapi->newDataset();
	dataset->next();

	
	Sequence* seq = NULL;

	if(isIdAvailable(argv[1],dataset)){
		seq = dataset->newSequence();
		char path[200];
		sprintf(path,"datasets/%s/",argv[1]);
		seq->add(argv[1], path);
		seq->next();
		printf("ok\n");
	}else{
		printf("id is not available!\n");
	}  	

	delete (dataset);
	delete (vtapi);
 
	return 0;
}
