/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.22
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package hindsight

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the TagGroupAndInput type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TagGroupAndInput{}

// TagGroupAndInput Compound AND group: all child filters must match.
type TagGroupAndInput struct {
	And []MentalModelTriggerInputTagGroupsInner `json:"and"`
}

type _TagGroupAndInput TagGroupAndInput

// NewTagGroupAndInput instantiates a new TagGroupAndInput 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 NewTagGroupAndInput(and []MentalModelTriggerInputTagGroupsInner) *TagGroupAndInput {
	this := TagGroupAndInput{}
	this.And = and
	return &this
}

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

// GetAnd returns the And field value
func (o *TagGroupAndInput) GetAnd() []MentalModelTriggerInputTagGroupsInner {
	if o == nil {
		var ret []MentalModelTriggerInputTagGroupsInner
		return ret
	}

	return o.And
}

// GetAndOk returns a tuple with the And field value
// and a boolean to check if the value has been set.
func (o *TagGroupAndInput) GetAndOk() ([]MentalModelTriggerInputTagGroupsInner, bool) {
	if o == nil {
		return nil, false
	}
	return o.And, true
}

// SetAnd sets field value
func (o *TagGroupAndInput) SetAnd(v []MentalModelTriggerInputTagGroupsInner) {
	o.And = v
}

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

func (o TagGroupAndInput) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["and"] = o.And
	return toSerialize, nil
}

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

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

	varTagGroupAndInput := _TagGroupAndInput{}

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

	if err != nil {
		return err
	}

	*o = TagGroupAndInput(varTagGroupAndInput)

	return err
}

type NullableTagGroupAndInput struct {
	value *TagGroupAndInput
	isSet bool
}

func (v NullableTagGroupAndInput) Get() *TagGroupAndInput {
	return v.value
}

func (v *NullableTagGroupAndInput) Set(val *TagGroupAndInput) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTagGroupAndInput(val *TagGroupAndInput) *NullableTagGroupAndInput {
	return &NullableTagGroupAndInput{value: val, isSet: true}
}

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

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


