#pragma once /* * Copyright (C) 2024 Dominik Meyer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * @brief The main namespace of this library for Redmine related datatypes, classes, and functions * */ #include "Redmine/Object.hpp" #include "nlohmann/json_fwd.hpp" namespace Redmine { /** * @brief Represents an IssueStatus within Redmine * * This can not be an enumeration as statusses can be added or deleted by an administrator * * The Redmine Rest API does not allow to add ad status therefore, no method to change or set * anything. */ class IssueStatus : public Redmine::Object { private: /// the json object to hold all data nlohmann::json data_; /// method to verify the json input void _verify(const nlohmann::json &data); public: /** * @brief Constructor for a Status using input from a json object * * @param status - the status representation as a json object */ explicit IssueStatus(const nlohmann::json &status); /** * @brief set the status from an json object * * @param data - the json object providing the status information */ void set(const nlohmann::json &data); /** * @brief returns the currently set data of the object as a json object * * @return nlohmann::json - the json object holding all object information */ nlohmann::json get() const; /** * @brief return the name of the status * * @return std::string */ std::string getName() const; /** * @brief return the id of the status * * @return std::uint64_t */ std::uint64_t getId() const; /** * @brief does the status mean the issue is closed * * @return true - the issue is closed * @return false - the issue is not closed */ bool isClosed() const; /** * @brief return a string representation of the status * * @return std::string */ std::string to_string() const; }; // class Status }; // namespace Redmine