// Copyrigth Xtooltech @ 2023- All rights reserved.(LXH)

#include "StationDataCategory.hpp"

namespace otx {
	namespace jidu {
		StationDataCategory::StationDataCategory() {
			this->mTestStatisticResult = "OK";
		}
		StationDataCategory::~StationDataCategory() {
			int size = this->mTestBlockList.size();
			for (int i = 0; i < size; i++) {
				StationDataBlock* item = this->mTestBlockList[i];
				delete item;
			}
			this->mTestBlockList.clear();
		}

		std::string StationDataCategory::getTestStatisticName() {
			return this->mTestStatisticName;
		}
		void StationDataCategory::setTestStatisticName(const std::string& v) {
			this->mTestStatisticName = v;
		}

		std::string StationDataCategory::getTestStatisticId() {
			return this->mTestStatisticId;
		}
		void StationDataCategory::setTestStatisticId(const std::string& v) {
			this->mTestStatisticId = v;
		}

		std::vector<StationDataBlock*>* StationDataCategory::getTestBlockList() {
			return &this->mTestBlockList;
		}
		StationDataBlock* StationDataCategory::getTestBlockById(const std::string& v) {
			int size = this->mTestBlockList.size();
			StationDataBlock* result = nullptr;
			for (int i = 0; i < size; i++) {
				StationDataBlock* item = this->mTestBlockList[i];
				if (item->getTestBlockId() == v) {
					result = item;
					break;
				}
			}
			return result;
		}
		StationDataBlock* StationDataCategory::newTestBlock() {
			StationDataBlock* result = new StationDataBlock();
			result->setTestStatisticId(this->mTestStatisticId);
			result->setTestStatisticName(this->mTestStatisticName);
			result->setTestBlockName(this->mTestStatisticName);
			result->setCategory(this);
			this->mTestBlockList.push_back(result);
			return result;
		}

		std::string StationDataCategory::getTestStatisticResult() {
			return this->mTestStatisticResult;
		}
		void StationDataCategory::setTestStatisticResult(const std::string& v) {
			this->mTestStatisticResult = v;
		}
	} // namespace jidu
} // namespace otx