/*
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 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 NullableString `json:"source_query,omitempty"`
	Content NullableString `json:"content,omitempty"`
	Tags []string `json:"tags,omitempty"`
	MaxTokens NullableInt32 `json:"max_tokens,omitempty"`
	Trigger NullableMentalModelTriggerOutput `json:"trigger,omitempty"`
	LastRefreshedAt NullableString `json:"last_refreshed_at,omitempty"`
	CreatedAt NullableString `json:"created_at,omitempty"`
	ReflectResponse map[string]interface{} `json:"reflect_response,omitempty"`
	IsStale NullableBool `json:"is_stale,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) *MentalModelResponse {
	this := MentalModelResponse{}
	this.Id = id
	this.BankId = bankId
	this.Name = name
	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{}
	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 if set, zero value otherwise (both if not set or set to explicit null).
func (o *MentalModelResponse) GetSourceQuery() string {
	if o == nil || IsNil(o.SourceQuery.Get()) {
		var ret string
		return ret
	}
	return *o.SourceQuery.Get()
}

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

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

	return false
}

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

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

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

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

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

	return false
}

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

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

// 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 (both if not set or set to explicit null).
func (o *MentalModelResponse) GetMaxTokens() int32 {
	if o == nil || IsNil(o.MaxTokens.Get()) {
		var ret int32
		return ret
	}
	return *o.MaxTokens.Get()
}

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

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

	return false
}

// SetMaxTokens gets a reference to the given NullableInt32 and assigns it to the MaxTokens field.
func (o *MentalModelResponse) SetMaxTokens(v int32) {
	o.MaxTokens.Set(&v)
}
// SetMaxTokensNil sets the value for MaxTokens to be an explicit nil
func (o *MentalModelResponse) SetMaxTokensNil() {
	o.MaxTokens.Set(nil)
}

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

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

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

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

	return false
}

// SetTrigger gets a reference to the given NullableMentalModelTriggerOutput and assigns it to the Trigger field.
func (o *MentalModelResponse) SetTrigger(v MentalModelTriggerOutput) {
	o.Trigger.Set(&v)
}
// SetTriggerNil sets the value for Trigger to be an explicit nil
func (o *MentalModelResponse) SetTriggerNil() {
	o.Trigger.Set(nil)
}

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

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

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

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

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

	return false
}

// SetIsStale gets a reference to the given NullableBool and assigns it to the IsStale field.
func (o *MentalModelResponse) SetIsStale(v bool) {
	o.IsStale.Set(&v)
}
// SetIsStaleNil sets the value for IsStale to be an explicit nil
func (o *MentalModelResponse) SetIsStaleNil() {
	o.IsStale.Set(nil)
}

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

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
	if o.SourceQuery.IsSet() {
		toSerialize["source_query"] = o.SourceQuery.Get()
	}
	if o.Content.IsSet() {
		toSerialize["content"] = o.Content.Get()
	}
	if !IsNil(o.Tags) {
		toSerialize["tags"] = o.Tags
	}
	if o.MaxTokens.IsSet() {
		toSerialize["max_tokens"] = o.MaxTokens.Get()
	}
	if o.Trigger.IsSet() {
		toSerialize["trigger"] = o.Trigger.Get()
	}
	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
	}
	if o.IsStale.IsSet() {
		toSerialize["is_stale"] = o.IsStale.Get()
	}
	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",
	}

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


