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

// EntityGraphResponse Response model for entity co-occurrence graph endpoint.
type EntityGraphResponse struct {
	Nodes []map[string]interface{} `json:"nodes"`
	Edges []map[string]interface{} `json:"edges"`
	TotalEntities int32 `json:"total_entities"`
	TotalEdges int32 `json:"total_edges"`
	Limit int32 `json:"limit"`
}

type _EntityGraphResponse EntityGraphResponse

// NewEntityGraphResponse instantiates a new EntityGraphResponse 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 NewEntityGraphResponse(nodes []map[string]interface{}, edges []map[string]interface{}, totalEntities int32, totalEdges int32, limit int32) *EntityGraphResponse {
	this := EntityGraphResponse{}
	this.Nodes = nodes
	this.Edges = edges
	this.TotalEntities = totalEntities
	this.TotalEdges = totalEdges
	this.Limit = limit
	return &this
}

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

// GetNodes returns the Nodes field value
func (o *EntityGraphResponse) GetNodes() []map[string]interface{} {
	if o == nil {
		var ret []map[string]interface{}
		return ret
	}

	return o.Nodes
}

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

// SetNodes sets field value
func (o *EntityGraphResponse) SetNodes(v []map[string]interface{}) {
	o.Nodes = v
}

// GetEdges returns the Edges field value
func (o *EntityGraphResponse) GetEdges() []map[string]interface{} {
	if o == nil {
		var ret []map[string]interface{}
		return ret
	}

	return o.Edges
}

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

// SetEdges sets field value
func (o *EntityGraphResponse) SetEdges(v []map[string]interface{}) {
	o.Edges = v
}

// GetTotalEntities returns the TotalEntities field value
func (o *EntityGraphResponse) GetTotalEntities() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.TotalEntities
}

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

// SetTotalEntities sets field value
func (o *EntityGraphResponse) SetTotalEntities(v int32) {
	o.TotalEntities = v
}

// GetTotalEdges returns the TotalEdges field value
func (o *EntityGraphResponse) GetTotalEdges() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.TotalEdges
}

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

// SetTotalEdges sets field value
func (o *EntityGraphResponse) SetTotalEdges(v int32) {
	o.TotalEdges = v
}

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

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

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

func (o EntityGraphResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["nodes"] = o.Nodes
	toSerialize["edges"] = o.Edges
	toSerialize["total_entities"] = o.TotalEntities
	toSerialize["total_edges"] = o.TotalEdges
	toSerialize["limit"] = o.Limit
	return toSerialize, nil
}

func (o *EntityGraphResponse) 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{
		"nodes",
		"edges",
		"total_entities",
		"total_edges",
		"limit",
	}

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

	varEntityGraphResponse := _EntityGraphResponse{}

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

	if err != nil {
		return err
	}

	*o = EntityGraphResponse(varEntityGraphResponse)

	return err
}

type NullableEntityGraphResponse struct {
	value *EntityGraphResponse
	isSet bool
}

func (v NullableEntityGraphResponse) Get() *EntityGraphResponse {
	return v.value
}

func (v *NullableEntityGraphResponse) Set(val *EntityGraphResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableEntityGraphResponse(val *EntityGraphResponse) *NullableEntityGraphResponse {
	return &NullableEntityGraphResponse{value: val, isSet: true}
}

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

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


