/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
* 
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


#include "ApiResponse.h"
#include "Helpers.h"

#include <sstream>

namespace org::openapitools::server::model
{

ApiResponse::ApiResponse()
{
    m_Code = 0;
    m_CodeIsSet = false;
    m_Type = "";
    m_TypeIsSet = false;
    m_Message = "";
    m_MessageIsSet = false;
    
}

void ApiResponse::validate() const
{
    std::stringstream msg;
    if (!validate(msg))
    {
        throw org::openapitools::server::helpers::ValidationException(msg.str());
    }
}

bool ApiResponse::validate(std::stringstream& msg) const
{
    return validate(msg, "");
}

bool ApiResponse::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
    bool success = true;
    const std::string _pathPrefix = pathPrefix.empty() ? "ApiResponse" : pathPrefix;

                
    return success;
}

bool ApiResponse::operator==(const ApiResponse& rhs) const
{
    return
    
    
    
    ((!codeIsSet() && !rhs.codeIsSet()) || (codeIsSet() && rhs.codeIsSet() && getCode() == rhs.getCode())) &&
    
    
    ((!typeIsSet() && !rhs.typeIsSet()) || (typeIsSet() && rhs.typeIsSet() && getType() == rhs.getType())) &&
    
    
    ((!messageIsSet() && !rhs.messageIsSet()) || (messageIsSet() && rhs.messageIsSet() && getMessage() == rhs.getMessage()))
    
    ;
}

bool ApiResponse::operator!=(const ApiResponse& rhs) const
{
    return !(*this == rhs);
}

void to_json(nlohmann::json& j, const ApiResponse& o)
{
    j = nlohmann::json::object();
    if(o.codeIsSet())
        j["code"] = o.m_Code;
    if(o.typeIsSet())
        j["type"] = o.m_Type;
    if(o.messageIsSet())
        j["message"] = o.m_Message;
    
}

void from_json(const nlohmann::json& j, ApiResponse& o)
{
    if(j.find("code") != j.end())
    {
        j.at("code").get_to(o.m_Code);
        o.m_CodeIsSet = true;
    } 
    if(j.find("type") != j.end())
    {
        j.at("type").get_to(o.m_Type);
        o.m_TypeIsSet = true;
    } 
    if(j.find("message") != j.end())
    {
        j.at("message").get_to(o.m_Message);
        o.m_MessageIsSet = true;
    } 
    
}

int32_t ApiResponse::getCode() const
{
    return m_Code;
}
void ApiResponse::setCode(int32_t const value)
{
    m_Code = value;
    m_CodeIsSet = true;
}
bool ApiResponse::codeIsSet() const
{
    return m_CodeIsSet;
}
void ApiResponse::unsetCode()
{
    m_CodeIsSet = false;
}
std::string ApiResponse::getType() const
{
    return m_Type;
}
void ApiResponse::setType(std::string const& value)
{
    m_Type = value;
    m_TypeIsSet = true;
}
bool ApiResponse::typeIsSet() const
{
    return m_TypeIsSet;
}
void ApiResponse::unsetType()
{
    m_TypeIsSet = false;
}
std::string ApiResponse::getMessage() const
{
    return m_Message;
}
void ApiResponse::setMessage(std::string const& value)
{
    m_Message = value;
    m_MessageIsSet = true;
}
bool ApiResponse::messageIsSet() const
{
    return m_MessageIsSet;
}
void ApiResponse::unsetMessage()
{
    m_MessageIsSet = false;
}


} // namespace org::openapitools::server::model

