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

// CreateMentalModelRequest Request model for creating a mental model.
type CreateMentalModelRequest struct {
	Id NullableString `json:"id,omitempty"`
	// Human-readable name for the mental model
	Name string `json:"name"`
	// The query to run to generate content
	SourceQuery string `json:"source_query"`
	// Tags for scoped visibility
	Tags []string `json:"tags,omitempty"`
	// Maximum tokens for generated content
	MaxTokens *int32 `json:"max_tokens,omitempty"`
	// Trigger settings
	Trigger *MentalModelTrigger `json:"trigger,omitempty"`
}

type _CreateMentalModelRequest CreateMentalModelRequest

// NewCreateMentalModelRequest instantiates a new CreateMentalModelRequest 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 NewCreateMentalModelRequest(name string, sourceQuery string) *CreateMentalModelRequest {
	this := CreateMentalModelRequest{}
	this.Name = name
	this.SourceQuery = sourceQuery
	var maxTokens int32 = 2048
	this.MaxTokens = &maxTokens
	return &this
}

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

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

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

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

	return false
}

// SetId gets a reference to the given NullableString and assigns it to the Id field.
func (o *CreateMentalModelRequest) SetId(v string) {
	o.Id.Set(&v)
}
// SetIdNil sets the value for Id to be an explicit nil
func (o *CreateMentalModelRequest) SetIdNil() {
	o.Id.Set(nil)
}

// UnsetId ensures that no value is present for Id, not even an explicit nil
func (o *CreateMentalModelRequest) UnsetId() {
	o.Id.Unset()
}

// GetName returns the Name field value
func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Name, true
}

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

// GetSourceQuery returns the SourceQuery field value
func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) GetSourceQueryOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.SourceQuery, true
}

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

// GetTags returns the Tags field value if set, zero value otherwise.
func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) SetTags(v []string) {
	o.Tags = v
}

// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise.
func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) SetMaxTokens(v int32) {
	o.MaxTokens = &v
}

// GetTrigger returns the Trigger field value if set, zero value otherwise.
func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) SetTrigger(v MentalModelTrigger) {
	o.Trigger = &v
}

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

func (o CreateMentalModelRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if o.Id.IsSet() {
		toSerialize["id"] = o.Id.Get()
	}
	toSerialize["name"] = o.Name
	toSerialize["source_query"] = o.SourceQuery
	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
	}
	return toSerialize, nil
}

func (o *CreateMentalModelRequest) 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{
		"name",
		"source_query",
	}

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

	varCreateMentalModelRequest := _CreateMentalModelRequest{}

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

	if err != nil {
		return err
	}

	*o = CreateMentalModelRequest(varCreateMentalModelRequest)

	return err
}

type NullableCreateMentalModelRequest struct {
	value *CreateMentalModelRequest
	isSet bool
}

func (v NullableCreateMentalModelRequest) Get() *CreateMentalModelRequest {
	return v.value
}

func (v *NullableCreateMentalModelRequest) Set(val *CreateMentalModelRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCreateMentalModelRequest(val *CreateMentalModelRequest) *NullableCreateMentalModelRequest {
	return &NullableCreateMentalModelRequest{value: val, isSet: true}
}

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

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


