/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.20
*/

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

package hindsight

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

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

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

type _TagGroupAnd TagGroupAnd

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

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

// GetAnd returns the And field value
func (o *TagGroupAnd) GetAnd() []RecallRequestTagGroupsInner {
	if o == nil {
		var ret []RecallRequestTagGroupsInner
		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 *TagGroupAnd) GetAndOk() ([]RecallRequestTagGroupsInner, bool) {
	if o == nil {
		return nil, false
	}
	return o.And, true
}

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

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

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

func (o *TagGroupAnd) 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)
		}
	}

	varTagGroupAnd := _TagGroupAnd{}

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

	if err != nil {
		return err
	}

	*o = TagGroupAnd(varTagGroupAnd)

	return err
}

type NullableTagGroupAnd struct {
	value *TagGroupAnd
	isSet bool
}

func (v NullableTagGroupAnd) Get() *TagGroupAnd {
	return v.value
}

func (v *NullableTagGroupAnd) Set(val *TagGroupAnd) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTagGroupAnd(val *TagGroupAnd) *NullableTagGroupAnd {
	return &NullableTagGroupAnd{value: val, isSet: true}
}

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

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


