/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package client

import (
	"encoding/json"
)

// checks if the OwnUserUpdateV2 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &OwnUserUpdateV2{}

// OwnUserUpdateV2 Update user information.
type OwnUserUpdateV2 struct {
	// New password.
	Password *string `json:"password,omitempty"`
	// Current password.
	CurrentPassword *string `json:"current_password,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _OwnUserUpdateV2 OwnUserUpdateV2

// NewOwnUserUpdateV2 instantiates a new OwnUserUpdateV2 object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewOwnUserUpdateV2() *OwnUserUpdateV2 {
	this := OwnUserUpdateV2{}
	return &this
}

// NewOwnUserUpdateV2WithDefaults instantiates a new OwnUserUpdateV2 object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewOwnUserUpdateV2WithDefaults() *OwnUserUpdateV2 {
	this := OwnUserUpdateV2{}
	return &this
}

// GetPassword returns the Password field value if set, zero value otherwise.
func (o *OwnUserUpdateV2) GetPassword() string {
	if o == nil || IsNil(o.Password) {
		var ret string
		return ret
	}
	return *o.Password
}

// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OwnUserUpdateV2) GetPasswordOk() (*string, bool) {
	if o == nil || IsNil(o.Password) {
		return nil, false
	}
	return o.Password, true
}

// HasPassword returns a boolean if a field has been set.
func (o *OwnUserUpdateV2) HasPassword() bool {
	if o != nil && !IsNil(o.Password) {
		return true
	}

	return false
}

// SetPassword gets a reference to the given string and assigns it to the Password field.
func (o *OwnUserUpdateV2) SetPassword(v string) {
	o.Password = &v
}

// GetCurrentPassword returns the CurrentPassword field value if set, zero value otherwise.
func (o *OwnUserUpdateV2) GetCurrentPassword() string {
	if o == nil || IsNil(o.CurrentPassword) {
		var ret string
		return ret
	}
	return *o.CurrentPassword
}

// GetCurrentPasswordOk returns a tuple with the CurrentPassword field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OwnUserUpdateV2) GetCurrentPasswordOk() (*string, bool) {
	if o == nil || IsNil(o.CurrentPassword) {
		return nil, false
	}
	return o.CurrentPassword, true
}

// HasCurrentPassword returns a boolean if a field has been set.
func (o *OwnUserUpdateV2) HasCurrentPassword() bool {
	if o != nil && !IsNil(o.CurrentPassword) {
		return true
	}

	return false
}

// SetCurrentPassword gets a reference to the given string and assigns it to the CurrentPassword field.
func (o *OwnUserUpdateV2) SetCurrentPassword(v string) {
	o.CurrentPassword = &v
}

func (o OwnUserUpdateV2) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o OwnUserUpdateV2) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Password) {
		toSerialize["password"] = o.Password
	}
	if !IsNil(o.CurrentPassword) {
		toSerialize["current_password"] = o.CurrentPassword
	}

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *OwnUserUpdateV2) UnmarshalJSON(data []byte) (err error) {
	varOwnUserUpdateV2 := _OwnUserUpdateV2{}

	err = json.Unmarshal(data, &varOwnUserUpdateV2)

	if err != nil {
		return err
	}

	*o = OwnUserUpdateV2(varOwnUserUpdateV2)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "password")
		delete(additionalProperties, "current_password")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableOwnUserUpdateV2 struct {
	value *OwnUserUpdateV2
	isSet bool
}

func (v NullableOwnUserUpdateV2) Get() *OwnUserUpdateV2 {
	return v.value
}

func (v *NullableOwnUserUpdateV2) Set(val *OwnUserUpdateV2) {
	v.value = val
	v.isSet = true
}

func (v NullableOwnUserUpdateV2) IsSet() bool {
	return v.isSet
}

func (v *NullableOwnUserUpdateV2) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableOwnUserUpdateV2(val *OwnUserUpdateV2) *NullableOwnUserUpdateV2 {
	return &NullableOwnUserUpdateV2{value: val, isSet: true}
}

func (v NullableOwnUserUpdateV2) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableOwnUserUpdateV2) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}


