/*
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 EntityListResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &EntityListResponse{}

// EntityListResponse Response model for entity list endpoint.
type EntityListResponse struct {
	Items []EntityListItem `json:"items"`
	Total int32 `json:"total"`
	Limit int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type _EntityListResponse EntityListResponse

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

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

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

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

// GetTotal returns the Total field value
func (o *EntityListResponse) 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 *EntityListResponse) GetTotalOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Total, true
}

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

// GetLimit returns the Limit field value
func (o *EntityListResponse) 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 *EntityListResponse) GetLimitOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Limit, true
}

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

// GetOffset returns the Offset field value
func (o *EntityListResponse) 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 *EntityListResponse) GetOffsetOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Offset, true
}

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

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

func (o EntityListResponse) 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 *EntityListResponse) 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)
		}
	}

	varEntityListResponse := _EntityListResponse{}

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

	if err != nil {
		return err
	}

	*o = EntityListResponse(varEntityListResponse)

	return err
}

type NullableEntityListResponse struct {
	value *EntityListResponse
	isSet bool
}

func (v NullableEntityListResponse) Get() *EntityListResponse {
	return v.value
}

func (v *NullableEntityListResponse) Set(val *EntityListResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableEntityListResponse(val *EntityListResponse) *NullableEntityListResponse {
	return &NullableEntityListResponse{value: val, isSet: true}
}

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

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


