/**
 * Swagger Petstore
 * This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.
 *
 * OpenAPI spec version: 1.0.0
 * Contact: apiteam@swagger.io
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */



#include "User.h"

namespace io {
namespace swagger {
namespace client {
namespace model {

User::User()
{
    m_Id = 0L;
    m_IdIsSet = false;
    m_Username = U("");
    m_UsernameIsSet = false;
    m_FirstName = U("");
    m_FirstNameIsSet = false;
    m_LastName = U("");
    m_LastNameIsSet = false;
    m_Email = U("");
    m_EmailIsSet = false;
    m_Password = U("");
    m_PasswordIsSet = false;
    m_Phone = U("");
    m_PhoneIsSet = false;
    m_UserStatus = 0;
    m_UserStatusIsSet = false;
    
}

User::~User()
{
}

void User::validate() 
{
    // TODO: implement validation
}

web::json::value User::toJson() const
{
    web::json::value val = web::json::value::object();
     
	if(m_IdIsSet)
    {
        val[U("id")] = ModelBase::toJson(m_Id);
    }
    if(m_UsernameIsSet)
    {
        val[U("username")] = ModelBase::toJson(m_Username);
    }
    if(m_FirstNameIsSet)
    {
        val[U("firstName")] = ModelBase::toJson(m_FirstName);
    }
    if(m_LastNameIsSet)
    {
        val[U("lastName")] = ModelBase::toJson(m_LastName);
    }
    if(m_EmailIsSet)
    {
        val[U("email")] = ModelBase::toJson(m_Email);
    }
    if(m_PasswordIsSet)
    {
        val[U("password")] = ModelBase::toJson(m_Password);
    }
    if(m_PhoneIsSet)
    {
        val[U("phone")] = ModelBase::toJson(m_Phone);
    }
    if(m_UserStatusIsSet)
    {
        val[U("userStatus")] = ModelBase::toJson(m_UserStatus);
    }
    

    return val;
}

void User::fromJson(web::json::value& val)
{
    if(val.has_field(U("id")))
    {
        setId(ModelBase::int64_tFromJson(val[U("id")]));
    }
    if(val.has_field(U("username")))
    {
        setUsername(ModelBase::stringFromJson(val[U("username")]));
                
    }
    if(val.has_field(U("firstName")))
    {
        setFirstName(ModelBase::stringFromJson(val[U("firstName")]));
                
    }
    if(val.has_field(U("lastName")))
    {
        setLastName(ModelBase::stringFromJson(val[U("lastName")]));
                
    }
    if(val.has_field(U("email")))
    {
        setEmail(ModelBase::stringFromJson(val[U("email")]));
                
    }
    if(val.has_field(U("password")))
    {
        setPassword(ModelBase::stringFromJson(val[U("password")]));
                
    }
    if(val.has_field(U("phone")))
    {
        setPhone(ModelBase::stringFromJson(val[U("phone")]));
                
    }
    if(val.has_field(U("userStatus")))
    {
        setUserStatus(ModelBase::int32_tFromJson(val[U("userStatus")]));
    }
    
}

void User::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
    utility::string_t namePrefix = prefix;
	if(namePrefix.size() > 0 && namePrefix[namePrefix.size() - 1] != U('.'))
	{
		namePrefix += U(".");
	}

	if(m_IdIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("id"), m_Id));
    }
    if(m_UsernameIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("username"), m_Username));
                
    }
    if(m_FirstNameIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("firstName"), m_FirstName));
                
    }
    if(m_LastNameIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("lastName"), m_LastName));
                
    }
    if(m_EmailIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("email"), m_Email));
                
    }
    if(m_PasswordIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("password"), m_Password));
                
    }
    if(m_PhoneIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("phone"), m_Phone));
                
    }
    if(m_UserStatusIsSet)
    {
        multipart->add(ModelBase::toHttpContent(namePrefix + U("userStatus"), m_UserStatus));
    }
    
}

void User::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
{
    utility::string_t namePrefix = prefix;
	if(namePrefix.size() > 0 && namePrefix[namePrefix.size() - 1] != U('.'))
	{
		namePrefix += U(".");
	}

    if(multipart->hasContent(U("id")))
    {
        setId(ModelBase::int64_tFromHttpContent(multipart->getContent(U("id"))));
    }
    if(multipart->hasContent(U("username")))
    {
        setUsername(ModelBase::stringFromHttpContent(multipart->getContent(U("username"))));
                
    }
    if(multipart->hasContent(U("firstName")))
    {
        setFirstName(ModelBase::stringFromHttpContent(multipart->getContent(U("firstName"))));
                
    }
    if(multipart->hasContent(U("lastName")))
    {
        setLastName(ModelBase::stringFromHttpContent(multipart->getContent(U("lastName"))));
                
    }
    if(multipart->hasContent(U("email")))
    {
        setEmail(ModelBase::stringFromHttpContent(multipart->getContent(U("email"))));
                
    }
    if(multipart->hasContent(U("password")))
    {
        setPassword(ModelBase::stringFromHttpContent(multipart->getContent(U("password"))));
                
    }
    if(multipart->hasContent(U("phone")))
    {
        setPhone(ModelBase::stringFromHttpContent(multipart->getContent(U("phone"))));
                
    }
    if(multipart->hasContent(U("userStatus")))
    {
        setUserStatus(ModelBase::int32_tFromHttpContent(multipart->getContent(U("userStatus"))));
    }
    
}
    
   
int64_t User::getId() const
{
	return m_Id;
}
void User::setId(int64_t value)
{
	m_Id = value;
    m_IdIsSet = true;
}
bool User::idIsSet() const
{
    return m_IdIsSet;
}
void User::unsetId() 
{
    m_IdIsSet = false;
}
utility::string_t User::getUsername() const
{
	return m_Username;
}
void User::setUsername(utility::string_t value)
{
	m_Username = value;
    m_UsernameIsSet = true;
}
bool User::usernameIsSet() const
{
    return m_UsernameIsSet;
}
void User::unsetUsername() 
{
    m_UsernameIsSet = false;
}
utility::string_t User::getFirstName() const
{
	return m_FirstName;
}
void User::setFirstName(utility::string_t value)
{
	m_FirstName = value;
    m_FirstNameIsSet = true;
}
bool User::firstNameIsSet() const
{
    return m_FirstNameIsSet;
}
void User::unsetFirstName() 
{
    m_FirstNameIsSet = false;
}
utility::string_t User::getLastName() const
{
	return m_LastName;
}
void User::setLastName(utility::string_t value)
{
	m_LastName = value;
    m_LastNameIsSet = true;
}
bool User::lastNameIsSet() const
{
    return m_LastNameIsSet;
}
void User::unsetLastName() 
{
    m_LastNameIsSet = false;
}
utility::string_t User::getEmail() const
{
	return m_Email;
}
void User::setEmail(utility::string_t value)
{
	m_Email = value;
    m_EmailIsSet = true;
}
bool User::emailIsSet() const
{
    return m_EmailIsSet;
}
void User::unsetEmail() 
{
    m_EmailIsSet = false;
}
utility::string_t User::getPassword() const
{
	return m_Password;
}
void User::setPassword(utility::string_t value)
{
	m_Password = value;
    m_PasswordIsSet = true;
}
bool User::passwordIsSet() const
{
    return m_PasswordIsSet;
}
void User::unsetPassword() 
{
    m_PasswordIsSet = false;
}
utility::string_t User::getPhone() const
{
	return m_Phone;
}
void User::setPhone(utility::string_t value)
{
	m_Phone = value;
    m_PhoneIsSet = true;
}
bool User::phoneIsSet() const
{
    return m_PhoneIsSet;
}
void User::unsetPhone() 
{
    m_PhoneIsSet = false;
}
int32_t User::getUserStatus() const
{
	return m_UserStatus;
}
void User::setUserStatus(int32_t value)
{
	m_UserStatus = value;
    m_UserStatusIsSet = true;
}
bool User::userStatusIsSet() const
{
    return m_UserStatusIsSet;
}
void User::unsetUserStatus() 
{
    m_UserStatusIsSet = false;
}

}
}
}
}

