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

// MentalModelResponse Response model for a mental model (stored reflect response).
type MentalModelResponse struct {
	Id string `json:"id"`
	BankId string `json:"bank_id"`
	Name string `json:"name"`
	SourceQuery string `json:"source_query"`
	// The mental model content as well-formatted markdown (auto-generated from reflect endpoint)
	Content string `json:"content"`
	Tags []string `json:"tags,omitempty"`
	MaxTokens *int32 `json:"max_tokens,omitempty"`
	Trigger *MentalModelTrigger `json:"trigger,omitempty"`
	LastRefreshedAt NullableString `json:"last_refreshed_at,omitempty"`
	CreatedAt NullableString `json:"created_at,omitempty"`
	ReflectResponse map[string]interface{} `json:"reflect_response,omitempty"`
}

type _MentalModelResponse MentalModelResponse

// NewMentalModelResponse instantiates a new MentalModelResponse 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 NewMentalModelResponse(id string, bankId string, name string, sourceQuery string, content string) *MentalModelResponse {
	this := MentalModelResponse{}
	this.Id = id
	this.BankId = bankId
	this.Name = name
	this.SourceQuery = sourceQuery
	this.Content = content
	var maxTokens int32 = 2048
	this.MaxTokens = &maxTokens
	return &this
}

// NewMentalModelResponseWithDefaults instantiates a new MentalModelResponse 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 NewMentalModelResponseWithDefaults() *MentalModelResponse {
	this := MentalModelResponse{}
	var maxTokens int32 = 2048
	this.MaxTokens = &maxTokens
	return &this
}

// GetId returns the Id field value
func (o *MentalModelResponse) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *MentalModelResponse) SetId(v string) {
	o.Id = v
}

// GetBankId returns the BankId field value
func (o *MentalModelResponse) GetBankId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.BankId
}

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

// SetBankId sets field value
func (o *MentalModelResponse) SetBankId(v string) {
	o.BankId = v
}

// GetName returns the Name field value
func (o *MentalModelResponse) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *MentalModelResponse) SetName(v string) {
	o.Name = v
}

// GetSourceQuery returns the SourceQuery field value
func (o *MentalModelResponse) GetSourceQuery() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SourceQuery
}

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

// SetSourceQuery sets field value
func (o *MentalModelResponse) SetSourceQuery(v string) {
	o.SourceQuery = v
}

// GetContent returns the Content field value
func (o *MentalModelResponse) GetContent() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Content
}

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

// SetContent sets field value
func (o *MentalModelResponse) SetContent(v string) {
	o.Content = v
}

// GetTags returns the Tags field value if set, zero value otherwise.
func (o *MentalModelResponse) GetTags() []string {
	if o == nil || IsNil(o.Tags) {
		var ret []string
		return ret
	}
	return o.Tags
}

// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MentalModelResponse) GetTagsOk() ([]string, bool) {
	if o == nil || IsNil(o.Tags) {
		return nil, false
	}
	return o.Tags, true
}

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

	return false
}

// SetTags gets a reference to the given []string and assigns it to the Tags field.
func (o *MentalModelResponse) SetTags(v []string) {
	o.Tags = v
}

// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise.
func (o *MentalModelResponse) GetMaxTokens() int32 {
	if o == nil || IsNil(o.MaxTokens) {
		var ret int32
		return ret
	}
	return *o.MaxTokens
}

// GetMaxTokensOk returns a tuple with the MaxTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MentalModelResponse) GetMaxTokensOk() (*int32, bool) {
	if o == nil || IsNil(o.MaxTokens) {
		return nil, false
	}
	return o.MaxTokens, true
}

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

	return false
}

// SetMaxTokens gets a reference to the given int32 and assigns it to the MaxTokens field.
func (o *MentalModelResponse) SetMaxTokens(v int32) {
	o.MaxTokens = &v
}

// GetTrigger returns the Trigger field value if set, zero value otherwise.
func (o *MentalModelResponse) GetTrigger() MentalModelTrigger {
	if o == nil || IsNil(o.Trigger) {
		var ret MentalModelTrigger
		return ret
	}
	return *o.Trigger
}

// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MentalModelResponse) GetTriggerOk() (*MentalModelTrigger, bool) {
	if o == nil || IsNil(o.Trigger) {
		return nil, false
	}
	return o.Trigger, true
}

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

	return false
}

// SetTrigger gets a reference to the given MentalModelTrigger and assigns it to the Trigger field.
func (o *MentalModelResponse) SetTrigger(v MentalModelTrigger) {
	o.Trigger = &v
}

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

// GetLastRefreshedAtOk returns a tuple with the LastRefreshedAt 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 *MentalModelResponse) GetLastRefreshedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastRefreshedAt.Get(), o.LastRefreshedAt.IsSet()
}

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

	return false
}

// SetLastRefreshedAt gets a reference to the given NullableString and assigns it to the LastRefreshedAt field.
func (o *MentalModelResponse) SetLastRefreshedAt(v string) {
	o.LastRefreshedAt.Set(&v)
}
// SetLastRefreshedAtNil sets the value for LastRefreshedAt to be an explicit nil
func (o *MentalModelResponse) SetLastRefreshedAtNil() {
	o.LastRefreshedAt.Set(nil)
}

// UnsetLastRefreshedAt ensures that no value is present for LastRefreshedAt, not even an explicit nil
func (o *MentalModelResponse) UnsetLastRefreshedAt() {
	o.LastRefreshedAt.Unset()
}

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

// GetCreatedAtOk returns a tuple with the CreatedAt 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 *MentalModelResponse) GetCreatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.CreatedAt.Get(), o.CreatedAt.IsSet()
}

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

	return false
}

// SetCreatedAt gets a reference to the given NullableString and assigns it to the CreatedAt field.
func (o *MentalModelResponse) SetCreatedAt(v string) {
	o.CreatedAt.Set(&v)
}
// SetCreatedAtNil sets the value for CreatedAt to be an explicit nil
func (o *MentalModelResponse) SetCreatedAtNil() {
	o.CreatedAt.Set(nil)
}

// UnsetCreatedAt ensures that no value is present for CreatedAt, not even an explicit nil
func (o *MentalModelResponse) UnsetCreatedAt() {
	o.CreatedAt.Unset()
}

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

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

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

	return false
}

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

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

func (o MentalModelResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["bank_id"] = o.BankId
	toSerialize["name"] = o.Name
	toSerialize["source_query"] = o.SourceQuery
	toSerialize["content"] = o.Content
	if !IsNil(o.Tags) {
		toSerialize["tags"] = o.Tags
	}
	if !IsNil(o.MaxTokens) {
		toSerialize["max_tokens"] = o.MaxTokens
	}
	if !IsNil(o.Trigger) {
		toSerialize["trigger"] = o.Trigger
	}
	if o.LastRefreshedAt.IsSet() {
		toSerialize["last_refreshed_at"] = o.LastRefreshedAt.Get()
	}
	if o.CreatedAt.IsSet() {
		toSerialize["created_at"] = o.CreatedAt.Get()
	}
	if o.ReflectResponse != nil {
		toSerialize["reflect_response"] = o.ReflectResponse
	}
	return toSerialize, nil
}

func (o *MentalModelResponse) 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{
		"id",
		"bank_id",
		"name",
		"source_query",
		"content",
	}

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

	varMentalModelResponse := _MentalModelResponse{}

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

	if err != nil {
		return err
	}

	*o = MentalModelResponse(varMentalModelResponse)

	return err
}

type NullableMentalModelResponse struct {
	value *MentalModelResponse
	isSet bool
}

func (v NullableMentalModelResponse) Get() *MentalModelResponse {
	return v.value
}

func (v *NullableMentalModelResponse) Set(val *MentalModelResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMentalModelResponse(val *MentalModelResponse) *NullableMentalModelResponse {
	return &NullableMentalModelResponse{value: val, isSet: true}
}

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

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


