/*
Lethean Blockchain API

OpenAPI for Lethean Blockchain

API version: 6.0.1
*/

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

package lthn

import (
	"encoding/json"
)

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

// HeightModel struct for HeightModel
type HeightModel struct {
	Height *int32 `json:"height,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _HeightModel HeightModel

// NewHeightModel instantiates a new HeightModel 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 NewHeightModel() *HeightModel {
	this := HeightModel{}
	return &this
}

// NewHeightModelWithDefaults instantiates a new HeightModel 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 NewHeightModelWithDefaults() *HeightModel {
	this := HeightModel{}
	return &this
}

// GetHeight returns the Height field value if set, zero value otherwise.
func (o *HeightModel) GetHeight() int32 {
	if o == nil || IsNil(o.Height) {
		var ret int32
		return ret
	}
	return *o.Height
}

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

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

	return false
}

// SetHeight gets a reference to the given int32 and assigns it to the Height field.
func (o *HeightModel) SetHeight(v int32) {
	o.Height = &v
}

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

func (o HeightModel) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Height) {
		toSerialize["height"] = o.Height
	}

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

	return toSerialize, nil
}

func (o *HeightModel) UnmarshalJSON(data []byte) (err error) {
	varHeightModel := _HeightModel{}

	err = json.Unmarshal(data, &varHeightModel)

	if err != nil {
		return err
	}

	*o = HeightModel(varHeightModel)

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

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

	return err
}

type NullableHeightModel struct {
	value *HeightModel
	isSet bool
}

func (v NullableHeightModel) Get() *HeightModel {
	return v.value
}

func (v *NullableHeightModel) Set(val *HeightModel) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableHeightModel(val *HeightModel) *NullableHeightModel {
	return &NullableHeightModel{value: val, isSet: true}
}

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

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


