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

// TagGroupOr Compound OR group: at least one child filter must match.
type TagGroupOr struct {
	Or []RecallRequestTagGroupsInner `json:"or"`
}

type _TagGroupOr TagGroupOr

// NewTagGroupOr instantiates a new TagGroupOr 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 NewTagGroupOr(or []RecallRequestTagGroupsInner) *TagGroupOr {
	this := TagGroupOr{}
	this.Or = or
	return &this
}

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

// GetOr returns the Or field value
func (o *TagGroupOr) GetOr() []RecallRequestTagGroupsInner {
	if o == nil {
		var ret []RecallRequestTagGroupsInner
		return ret
	}

	return o.Or
}

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

// SetOr sets field value
func (o *TagGroupOr) SetOr(v []RecallRequestTagGroupsInner) {
	o.Or = v
}

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

func (o TagGroupOr) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["or"] = o.Or
	return toSerialize, nil
}

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

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

	varTagGroupOr := _TagGroupOr{}

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

	if err != nil {
		return err
	}

	*o = TagGroupOr(varTagGroupOr)

	return err
}

type NullableTagGroupOr struct {
	value *TagGroupOr
	isSet bool
}

func (v NullableTagGroupOr) Get() *TagGroupOr {
	return v.value
}

func (v *NullableTagGroupOr) Set(val *TagGroupOr) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTagGroupOr(val *TagGroupOr) *NullableTagGroupOr {
	return &NullableTagGroupOr{value: val, isSet: true}
}

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

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


