/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.17
*/

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

package hindsight

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

// ListMemoryUnitsResponse Response model for list memory units endpoint.
type ListMemoryUnitsResponse struct {
	Items []map[string]interface{} `json:"items"`
	Total int32 `json:"total"`
	Limit int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type _ListMemoryUnitsResponse ListMemoryUnitsResponse

// NewListMemoryUnitsResponse instantiates a new ListMemoryUnitsResponse 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 NewListMemoryUnitsResponse(items []map[string]interface{}, total int32, limit int32, offset int32) *ListMemoryUnitsResponse {
	this := ListMemoryUnitsResponse{}
	this.Items = items
	this.Total = total
	this.Limit = limit
	this.Offset = offset
	return &this
}

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

// GetItems returns the Items field value
func (o *ListMemoryUnitsResponse) GetItems() []map[string]interface{} {
	if o == nil {
		var ret []map[string]interface{}
		return ret
	}

	return o.Items
}

// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *ListMemoryUnitsResponse) GetItemsOk() ([]map[string]interface{}, bool) {
	if o == nil {
		return nil, false
	}
	return o.Items, true
}

// SetItems sets field value
func (o *ListMemoryUnitsResponse) SetItems(v []map[string]interface{}) {
	o.Items = v
}

// GetTotal returns the Total field value
func (o *ListMemoryUnitsResponse) GetTotal() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Total
}

// GetTotalOk returns a tuple with the Total field value
// and a boolean to check if the value has been set.
func (o *ListMemoryUnitsResponse) GetTotalOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Total, true
}

// SetTotal sets field value
func (o *ListMemoryUnitsResponse) SetTotal(v int32) {
	o.Total = v
}

// GetLimit returns the Limit field value
func (o *ListMemoryUnitsResponse) GetLimit() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Limit
}

// GetLimitOk returns a tuple with the Limit field value
// and a boolean to check if the value has been set.
func (o *ListMemoryUnitsResponse) GetLimitOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Limit, true
}

// SetLimit sets field value
func (o *ListMemoryUnitsResponse) SetLimit(v int32) {
	o.Limit = v
}

// GetOffset returns the Offset field value
func (o *ListMemoryUnitsResponse) GetOffset() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Offset
}

// GetOffsetOk returns a tuple with the Offset field value
// and a boolean to check if the value has been set.
func (o *ListMemoryUnitsResponse) GetOffsetOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Offset, true
}

// SetOffset sets field value
func (o *ListMemoryUnitsResponse) SetOffset(v int32) {
	o.Offset = v
}

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

func (o ListMemoryUnitsResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["items"] = o.Items
	toSerialize["total"] = o.Total
	toSerialize["limit"] = o.Limit
	toSerialize["offset"] = o.Offset
	return toSerialize, nil
}

func (o *ListMemoryUnitsResponse) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"items",
		"total",
		"limit",
		"offset",
	}

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

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varListMemoryUnitsResponse := _ListMemoryUnitsResponse{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varListMemoryUnitsResponse)

	if err != nil {
		return err
	}

	*o = ListMemoryUnitsResponse(varListMemoryUnitsResponse)

	return err
}

type NullableListMemoryUnitsResponse struct {
	value *ListMemoryUnitsResponse
	isSet bool
}

func (v NullableListMemoryUnitsResponse) Get() *ListMemoryUnitsResponse {
	return v.value
}

func (v *NullableListMemoryUnitsResponse) Set(val *ListMemoryUnitsResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableListMemoryUnitsResponse(val *ListMemoryUnitsResponse) *NullableListMemoryUnitsResponse {
	return &NullableListMemoryUnitsResponse{value: val, isSet: true}
}

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

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


