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

// ReflectResponse Response model for think endpoint.
type ReflectResponse struct {
	// The reflect response as well-formatted markdown (headers, lists, bold/italic, code blocks, etc.)
	Text string `json:"text"`
	BasedOn NullableReflectBasedOn `json:"based_on,omitempty"`
	StructuredOutput map[string]interface{} `json:"structured_output,omitempty"`
	Usage NullableTokenUsage `json:"usage,omitempty"`
	Trace NullableReflectTrace `json:"trace,omitempty"`
}

type _ReflectResponse ReflectResponse

// NewReflectResponse instantiates a new ReflectResponse 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 NewReflectResponse(text string) *ReflectResponse {
	this := ReflectResponse{}
	this.Text = text
	return &this
}

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

// GetText returns the Text field value
func (o *ReflectResponse) GetText() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Text
}

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

// SetText sets field value
func (o *ReflectResponse) SetText(v string) {
	o.Text = v
}

// GetBasedOn returns the BasedOn field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectResponse) GetBasedOn() ReflectBasedOn {
	if o == nil || IsNil(o.BasedOn.Get()) {
		var ret ReflectBasedOn
		return ret
	}
	return *o.BasedOn.Get()
}

// GetBasedOnOk returns a tuple with the BasedOn 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 *ReflectResponse) GetBasedOnOk() (*ReflectBasedOn, bool) {
	if o == nil {
		return nil, false
	}
	return o.BasedOn.Get(), o.BasedOn.IsSet()
}

// HasBasedOn returns a boolean if a field has been set.
func (o *ReflectResponse) HasBasedOn() bool {
	if o != nil && o.BasedOn.IsSet() {
		return true
	}

	return false
}

// SetBasedOn gets a reference to the given NullableReflectBasedOn and assigns it to the BasedOn field.
func (o *ReflectResponse) SetBasedOn(v ReflectBasedOn) {
	o.BasedOn.Set(&v)
}
// SetBasedOnNil sets the value for BasedOn to be an explicit nil
func (o *ReflectResponse) SetBasedOnNil() {
	o.BasedOn.Set(nil)
}

// UnsetBasedOn ensures that no value is present for BasedOn, not even an explicit nil
func (o *ReflectResponse) UnsetBasedOn() {
	o.BasedOn.Unset()
}

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

// GetStructuredOutputOk returns a tuple with the StructuredOutput 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 *ReflectResponse) GetStructuredOutputOk() (map[string]interface{}, bool) {
	if o == nil || IsNil(o.StructuredOutput) {
		return map[string]interface{}{}, false
	}
	return o.StructuredOutput, true
}

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

	return false
}

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

// GetUsage returns the Usage field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectResponse) GetUsage() TokenUsage {
	if o == nil || IsNil(o.Usage.Get()) {
		var ret TokenUsage
		return ret
	}
	return *o.Usage.Get()
}

// GetUsageOk returns a tuple with the Usage 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 *ReflectResponse) GetUsageOk() (*TokenUsage, bool) {
	if o == nil {
		return nil, false
	}
	return o.Usage.Get(), o.Usage.IsSet()
}

// HasUsage returns a boolean if a field has been set.
func (o *ReflectResponse) HasUsage() bool {
	if o != nil && o.Usage.IsSet() {
		return true
	}

	return false
}

// SetUsage gets a reference to the given NullableTokenUsage and assigns it to the Usage field.
func (o *ReflectResponse) SetUsage(v TokenUsage) {
	o.Usage.Set(&v)
}
// SetUsageNil sets the value for Usage to be an explicit nil
func (o *ReflectResponse) SetUsageNil() {
	o.Usage.Set(nil)
}

// UnsetUsage ensures that no value is present for Usage, not even an explicit nil
func (o *ReflectResponse) UnsetUsage() {
	o.Usage.Unset()
}

// GetTrace returns the Trace field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectResponse) GetTrace() ReflectTrace {
	if o == nil || IsNil(o.Trace.Get()) {
		var ret ReflectTrace
		return ret
	}
	return *o.Trace.Get()
}

// 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 *ReflectResponse) GetTraceOk() (*ReflectTrace, bool) {
	if o == nil {
		return nil, false
	}
	return o.Trace.Get(), o.Trace.IsSet()
}

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

	return false
}

// SetTrace gets a reference to the given NullableReflectTrace and assigns it to the Trace field.
func (o *ReflectResponse) SetTrace(v ReflectTrace) {
	o.Trace.Set(&v)
}
// SetTraceNil sets the value for Trace to be an explicit nil
func (o *ReflectResponse) SetTraceNil() {
	o.Trace.Set(nil)
}

// UnsetTrace ensures that no value is present for Trace, not even an explicit nil
func (o *ReflectResponse) UnsetTrace() {
	o.Trace.Unset()
}

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

func (o ReflectResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["text"] = o.Text
	if o.BasedOn.IsSet() {
		toSerialize["based_on"] = o.BasedOn.Get()
	}
	if o.StructuredOutput != nil {
		toSerialize["structured_output"] = o.StructuredOutput
	}
	if o.Usage.IsSet() {
		toSerialize["usage"] = o.Usage.Get()
	}
	if o.Trace.IsSet() {
		toSerialize["trace"] = o.Trace.Get()
	}
	return toSerialize, nil
}

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

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

	varReflectResponse := _ReflectResponse{}

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

	if err != nil {
		return err
	}

	*o = ReflectResponse(varReflectResponse)

	return err
}

type NullableReflectResponse struct {
	value *ReflectResponse
	isSet bool
}

func (v NullableReflectResponse) Get() *ReflectResponse {
	return v.value
}

func (v *NullableReflectResponse) Set(val *ReflectResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableReflectResponse(val *ReflectResponse) *NullableReflectResponse {
	return &NullableReflectResponse{value: val, isSet: true}
}

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

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


