/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

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

package client

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

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

// AddDevicesToGroup200Response JSON object listing how many devices were updated. 
type AddDevicesToGroup200Response struct {
	// Number of devices listed that changed group. 
	UpdatedCount int32 `json:"updated_count"`
	// Number of devices listed that matched a valid device id internally. 
	MatchedCount int32 `json:"matched_count"`
}

type _AddDevicesToGroup200Response AddDevicesToGroup200Response

// NewAddDevicesToGroup200Response instantiates a new AddDevicesToGroup200Response 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 NewAddDevicesToGroup200Response(updatedCount int32, matchedCount int32) *AddDevicesToGroup200Response {
	this := AddDevicesToGroup200Response{}
	this.UpdatedCount = updatedCount
	this.MatchedCount = matchedCount
	return &this
}

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

// GetUpdatedCount returns the UpdatedCount field value
func (o *AddDevicesToGroup200Response) GetUpdatedCount() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.UpdatedCount
}

// GetUpdatedCountOk returns a tuple with the UpdatedCount field value
// and a boolean to check if the value has been set.
func (o *AddDevicesToGroup200Response) GetUpdatedCountOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.UpdatedCount, true
}

// SetUpdatedCount sets field value
func (o *AddDevicesToGroup200Response) SetUpdatedCount(v int32) {
	o.UpdatedCount = v
}

// GetMatchedCount returns the MatchedCount field value
func (o *AddDevicesToGroup200Response) GetMatchedCount() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.MatchedCount
}

// GetMatchedCountOk returns a tuple with the MatchedCount field value
// and a boolean to check if the value has been set.
func (o *AddDevicesToGroup200Response) GetMatchedCountOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.MatchedCount, true
}

// SetMatchedCount sets field value
func (o *AddDevicesToGroup200Response) SetMatchedCount(v int32) {
	o.MatchedCount = v
}

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

func (o AddDevicesToGroup200Response) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["updated_count"] = o.UpdatedCount
	toSerialize["matched_count"] = o.MatchedCount
	return toSerialize, nil
}

func (o *AddDevicesToGroup200Response) 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{
		"updated_count",
		"matched_count",
	}

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

	varAddDevicesToGroup200Response := _AddDevicesToGroup200Response{}

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

	if err != nil {
		return err
	}

	*o = AddDevicesToGroup200Response(varAddDevicesToGroup200Response)

	return err
}

type NullableAddDevicesToGroup200Response struct {
	value *AddDevicesToGroup200Response
	isSet bool
}

func (v NullableAddDevicesToGroup200Response) Get() *AddDevicesToGroup200Response {
	return v.value
}

func (v *NullableAddDevicesToGroup200Response) Set(val *AddDevicesToGroup200Response) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAddDevicesToGroup200Response(val *AddDevicesToGroup200Response) *NullableAddDevicesToGroup200Response {
	return &NullableAddDevicesToGroup200Response{value: val, isSet: true}
}

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

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


