/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.5.3
*/

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

package hindsight

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

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

// MentalModelListResponse Response model for listing mental models.
type MentalModelListResponse struct {
	Items []MentalModelResponse `json:"items"`
}

type _MentalModelListResponse MentalModelListResponse

// NewMentalModelListResponse instantiates a new MentalModelListResponse 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 NewMentalModelListResponse(items []MentalModelResponse) *MentalModelListResponse {
	this := MentalModelListResponse{}
	this.Items = items
	return &this
}

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

// GetItems returns the Items field value
func (o *MentalModelListResponse) GetItems() []MentalModelResponse {
	if o == nil {
		var ret []MentalModelResponse
		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 *MentalModelListResponse) GetItemsOk() ([]MentalModelResponse, bool) {
	if o == nil {
		return nil, false
	}
	return o.Items, true
}

// SetItems sets field value
func (o *MentalModelListResponse) SetItems(v []MentalModelResponse) {
	o.Items = v
}

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

func (o MentalModelListResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["items"] = o.Items
	return toSerialize, nil
}

func (o *MentalModelListResponse) 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",
	}

	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)
		}
	}

	varMentalModelListResponse := _MentalModelListResponse{}

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

	if err != nil {
		return err
	}

	*o = MentalModelListResponse(varMentalModelListResponse)

	return err
}

type NullableMentalModelListResponse struct {
	value *MentalModelListResponse
	isSet bool
}

func (v NullableMentalModelListResponse) Get() *MentalModelListResponse {
	return v.value
}

func (v *NullableMentalModelListResponse) Set(val *MentalModelListResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMentalModelListResponse(val *MentalModelListResponse) *NullableMentalModelListResponse {
	return &NullableMentalModelListResponse{value: val, isSet: true}
}

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

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


