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

// ReflectMentalModel A mental model used during reflect.
type ReflectMentalModel struct {
	// Mental model ID
	Id string `json:"id"`
	// Mental model content
	Text string `json:"text"`
	Context NullableString `json:"context,omitempty"`
}

type _ReflectMentalModel ReflectMentalModel

// NewReflectMentalModel instantiates a new ReflectMentalModel 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 NewReflectMentalModel(id string, text string) *ReflectMentalModel {
	this := ReflectMentalModel{}
	this.Id = id
	this.Text = text
	return &this
}

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

// GetId returns the Id field value
func (o *ReflectMentalModel) 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 *ReflectMentalModel) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Id, true
}

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

// GetText returns the Text field value
func (o *ReflectMentalModel) 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 *ReflectMentalModel) GetTextOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Text, true
}

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

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

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

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

	return false
}

// SetContext gets a reference to the given NullableString and assigns it to the Context field.
func (o *ReflectMentalModel) SetContext(v string) {
	o.Context.Set(&v)
}
// SetContextNil sets the value for Context to be an explicit nil
func (o *ReflectMentalModel) SetContextNil() {
	o.Context.Set(nil)
}

// UnsetContext ensures that no value is present for Context, not even an explicit nil
func (o *ReflectMentalModel) UnsetContext() {
	o.Context.Unset()
}

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

func (o ReflectMentalModel) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["text"] = o.Text
	if o.Context.IsSet() {
		toSerialize["context"] = o.Context.Get()
	}
	return toSerialize, nil
}

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

	varReflectMentalModel := _ReflectMentalModel{}

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

	if err != nil {
		return err
	}

	*o = ReflectMentalModel(varReflectMentalModel)

	return err
}

type NullableReflectMentalModel struct {
	value *ReflectMentalModel
	isSet bool
}

func (v NullableReflectMentalModel) Get() *ReflectMentalModel {
	return v.value
}

func (v *NullableReflectMentalModel) Set(val *ReflectMentalModel) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableReflectMentalModel(val *ReflectMentalModel) *NullableReflectMentalModel {
	return &NullableReflectMentalModel{value: val, isSet: true}
}

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

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


