#include "item.h"

int Item::get(string id) {
	//nacteni dat ze serveru
	string status;
	int statusCode;
	ParamMap params;

	Json::Value data = Comunicator::getInstance()->sendJsonRequest(objectType, "get", id, status, statusCode, params);

	//kontrola kodu
	if (statusCode != 200) {
		//nastala chyba
		cout << "NASTALA CHYBA" << endl;
		cout << "Server hlásí: " << status << endl;
		cout << "Kód chyby:    " << statusCode << endl << endl;

		return 0;
	}

	//nastaveni dat
	this->id = id;
	objectData = data;

	return 1;
}

int Item::post(Json::Value data) {
	return 1;
}

string Item::getId() {
	return id;
}
