#ifndef DResult_H
#define DResult_H

#include <string>
#include <memory>
#include <list>

#include "MySerializable.h"

#include "TypeDefs.h"
#include "DiagService.h"
#include "DResultState.h"

namespace ProtoGenWrapper
{
	class DError;
	class DResponse;
	
	class DResult : public MySerializable
	{
	public:
		DResult();
		DResult(int64 handle, const DiagService& diagService, const DResultState& resultState);
		DResult(const DResult& other);
		DResult& operator=(const DResult& other);

		int64 GetHandle() const;
		void SetHandle(int64 handle);
		DResultState GetResultState() const;
		void SetResultState(const DResultState &resultstate);
		DiagService GetDiagService() const;
		void SetDiagService(const DiagService& diagService);
		std::string GetServiceShortName() const;
		void SetServiceShortName(const std::string& serviceShortName);
		int32 GetResultType() const;
		void SetResultType(int32 resultType);
		std::shared_ptr<DError> GetError() const;
		void SetError(std::shared_ptr<DError> error);
		std::list<std::shared_ptr<DResponse>> GetResponses() const;
		void SetResponses(const std::list<std::shared_ptr<DResponse>>& responses);

		void Serialize(std::string* output) const override;
		void Deserialize(const std::string& data) override;

	protected:
		int64 _handle = 0;
		DiagService _diagService; // obsolete?
		DResultState _resultState;
		std::string _serviceShortName;
		int32 _resultType = 0;
		std::shared_ptr<DError> _error;
		std::list<std::shared_ptr<DResponse>> _responses;
	};
}
#endif // DResult_H
