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

// RecallResponse Response model for recall endpoints.
type RecallResponse struct {
	Results []RecallResult `json:"results"`
	Trace map[string]interface{} `json:"trace,omitempty"`
	Entities map[string]EntityStateResponse `json:"entities,omitempty"`
	Chunks map[string]ChunkData `json:"chunks,omitempty"`
	SourceFacts map[string]RecallResult `json:"source_facts,omitempty"`
}

type _RecallResponse RecallResponse

// NewRecallResponse instantiates a new RecallResponse 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 NewRecallResponse(results []RecallResult) *RecallResponse {
	this := RecallResponse{}
	this.Results = results
	return &this
}

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

// GetResults returns the Results field value
func (o *RecallResponse) GetResults() []RecallResult {
	if o == nil {
		var ret []RecallResult
		return ret
	}

	return o.Results
}

// GetResultsOk returns a tuple with the Results field value
// and a boolean to check if the value has been set.
func (o *RecallResponse) GetResultsOk() ([]RecallResult, bool) {
	if o == nil {
		return nil, false
	}
	return o.Results, true
}

// SetResults sets field value
func (o *RecallResponse) SetResults(v []RecallResult) {
	o.Results = v
}

// GetTrace returns the Trace field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *RecallResponse) GetTrace() map[string]interface{} {
	if o == nil {
		var ret map[string]interface{}
		return ret
	}
	return o.Trace
}

// GetTraceOk returns a tuple with the Trace field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *RecallResponse) GetTraceOk() (map[string]interface{}, bool) {
	if o == nil || IsNil(o.Trace) {
		return map[string]interface{}{}, false
	}
	return o.Trace, true
}

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

	return false
}

// SetTrace gets a reference to the given map[string]interface{} and assigns it to the Trace field.
func (o *RecallResponse) SetTrace(v map[string]interface{}) {
	o.Trace = v
}

// GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *RecallResponse) GetEntities() map[string]EntityStateResponse {
	if o == nil {
		var ret map[string]EntityStateResponse
		return ret
	}
	return o.Entities
}

// GetEntitiesOk returns a tuple with the Entities field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *RecallResponse) GetEntitiesOk() (map[string]EntityStateResponse, bool) {
	if o == nil || IsNil(o.Entities) {
		return map[string]EntityStateResponse{}, false
	}
	return o.Entities, true
}

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

	return false
}

// SetEntities gets a reference to the given map[string]EntityStateResponse and assigns it to the Entities field.
func (o *RecallResponse) SetEntities(v map[string]EntityStateResponse) {
	o.Entities = v
}

// GetChunks returns the Chunks field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *RecallResponse) GetChunks() map[string]ChunkData {
	if o == nil {
		var ret map[string]ChunkData
		return ret
	}
	return o.Chunks
}

// GetChunksOk returns a tuple with the Chunks field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *RecallResponse) GetChunksOk() (map[string]ChunkData, bool) {
	if o == nil || IsNil(o.Chunks) {
		return map[string]ChunkData{}, false
	}
	return o.Chunks, true
}

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

	return false
}

// SetChunks gets a reference to the given map[string]ChunkData and assigns it to the Chunks field.
func (o *RecallResponse) SetChunks(v map[string]ChunkData) {
	o.Chunks = v
}

// GetSourceFacts returns the SourceFacts field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *RecallResponse) GetSourceFacts() map[string]RecallResult {
	if o == nil {
		var ret map[string]RecallResult
		return ret
	}
	return o.SourceFacts
}

// GetSourceFactsOk returns a tuple with the SourceFacts field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *RecallResponse) GetSourceFactsOk() (map[string]RecallResult, bool) {
	if o == nil || IsNil(o.SourceFacts) {
		return map[string]RecallResult{}, false
	}
	return o.SourceFacts, true
}

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

	return false
}

// SetSourceFacts gets a reference to the given map[string]RecallResult and assigns it to the SourceFacts field.
func (o *RecallResponse) SetSourceFacts(v map[string]RecallResult) {
	o.SourceFacts = v
}

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

func (o RecallResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["results"] = o.Results
	if o.Trace != nil {
		toSerialize["trace"] = o.Trace
	}
	if o.Entities != nil {
		toSerialize["entities"] = o.Entities
	}
	if o.Chunks != nil {
		toSerialize["chunks"] = o.Chunks
	}
	if o.SourceFacts != nil {
		toSerialize["source_facts"] = o.SourceFacts
	}
	return toSerialize, nil
}

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

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

	varRecallResponse := _RecallResponse{}

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

	if err != nil {
		return err
	}

	*o = RecallResponse(varRecallResponse)

	return err
}

type NullableRecallResponse struct {
	value *RecallResponse
	isSet bool
}

func (v NullableRecallResponse) Get() *RecallResponse {
	return v.value
}

func (v *NullableRecallResponse) Set(val *RecallResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRecallResponse(val *RecallResponse) *NullableRecallResponse {
	return &NullableRecallResponse{value: val, isSet: true}
}

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

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


