/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.21
*/

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

package hindsight

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

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

// TagGroupLeaf A leaf tag filter: matches memories by tag list and match mode.
type TagGroupLeaf struct {
	Tags []string `json:"tags"`
	Match *string `json:"match,omitempty"`
}

type _TagGroupLeaf TagGroupLeaf

// NewTagGroupLeaf instantiates a new TagGroupLeaf 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 NewTagGroupLeaf(tags []string) *TagGroupLeaf {
	this := TagGroupLeaf{}
	this.Tags = tags
	var match string = "any_strict"
	this.Match = &match
	return &this
}

// NewTagGroupLeafWithDefaults instantiates a new TagGroupLeaf 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 NewTagGroupLeafWithDefaults() *TagGroupLeaf {
	this := TagGroupLeaf{}
	var match string = "any_strict"
	this.Match = &match
	return &this
}

// GetTags returns the Tags field value
func (o *TagGroupLeaf) GetTags() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.Tags
}

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

// SetTags sets field value
func (o *TagGroupLeaf) SetTags(v []string) {
	o.Tags = v
}

// GetMatch returns the Match field value if set, zero value otherwise.
func (o *TagGroupLeaf) GetMatch() string {
	if o == nil || IsNil(o.Match) {
		var ret string
		return ret
	}
	return *o.Match
}

// GetMatchOk returns a tuple with the Match field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TagGroupLeaf) GetMatchOk() (*string, bool) {
	if o == nil || IsNil(o.Match) {
		return nil, false
	}
	return o.Match, true
}

// HasMatch returns a boolean if a field has been set.
func (o *TagGroupLeaf) HasMatch() bool {
	if o != nil && !IsNil(o.Match) {
		return true
	}

	return false
}

// SetMatch gets a reference to the given string and assigns it to the Match field.
func (o *TagGroupLeaf) SetMatch(v string) {
	o.Match = &v
}

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

func (o TagGroupLeaf) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["tags"] = o.Tags
	if !IsNil(o.Match) {
		toSerialize["match"] = o.Match
	}
	return toSerialize, nil
}

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

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

	varTagGroupLeaf := _TagGroupLeaf{}

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

	if err != nil {
		return err
	}

	*o = TagGroupLeaf(varTagGroupLeaf)

	return err
}

type NullableTagGroupLeaf struct {
	value *TagGroupLeaf
	isSet bool
}

func (v NullableTagGroupLeaf) Get() *TagGroupLeaf {
	return v.value
}

func (v *NullableTagGroupLeaf) Set(val *TagGroupLeaf) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTagGroupLeaf(val *TagGroupLeaf) *NullableTagGroupLeaf {
	return &NullableTagGroupLeaf{value: val, isSet: true}
}

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

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


