/*
Edge Application API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: 2.0.0
*/

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

package edgeapplications

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

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

// DeviceGroupsResultResponse struct for DeviceGroupsResultResponse
type DeviceGroupsResultResponse struct {
	Id *int64 `json:"id,omitempty"`
	Name string `json:"name"`
	UserAgent string `json:"user_agent"`
}

type _DeviceGroupsResultResponse DeviceGroupsResultResponse

// NewDeviceGroupsResultResponse instantiates a new DeviceGroupsResultResponse 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 NewDeviceGroupsResultResponse(name string, userAgent string) *DeviceGroupsResultResponse {
	this := DeviceGroupsResultResponse{}
	this.Name = name
	this.UserAgent = userAgent
	return &this
}

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

// GetId returns the Id field value if set, zero value otherwise.
func (o *DeviceGroupsResultResponse) GetId() int64 {
	if o == nil || IsNil(o.Id) {
		var ret int64
		return ret
	}
	return *o.Id
}

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

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

	return false
}

// SetId gets a reference to the given int64 and assigns it to the Id field.
func (o *DeviceGroupsResultResponse) SetId(v int64) {
	o.Id = &v
}

// GetName returns the Name field value
func (o *DeviceGroupsResultResponse) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *DeviceGroupsResultResponse) SetName(v string) {
	o.Name = v
}

// GetUserAgent returns the UserAgent field value
func (o *DeviceGroupsResultResponse) GetUserAgent() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.UserAgent
}

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

// SetUserAgent sets field value
func (o *DeviceGroupsResultResponse) SetUserAgent(v string) {
	o.UserAgent = v
}

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

func (o DeviceGroupsResultResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Id) {
		toSerialize["id"] = o.Id
	}
	toSerialize["name"] = o.Name
	toSerialize["user_agent"] = o.UserAgent
	return toSerialize, nil
}

func (o *DeviceGroupsResultResponse) 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{
		"name",
		"user_agent",
	}

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

	varDeviceGroupsResultResponse := _DeviceGroupsResultResponse{}

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

	if err != nil {
		return err
	}

	*o = DeviceGroupsResultResponse(varDeviceGroupsResultResponse)

	return err
}

type NullableDeviceGroupsResultResponse struct {
	value *DeviceGroupsResultResponse
	isSet bool
}

func (v NullableDeviceGroupsResultResponse) Get() *DeviceGroupsResultResponse {
	return v.value
}

func (v *NullableDeviceGroupsResultResponse) Set(val *DeviceGroupsResultResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeviceGroupsResultResponse(val *DeviceGroupsResultResponse) *NullableDeviceGroupsResultResponse {
	return &NullableDeviceGroupsResultResponse{value: val, isSet: true}
}

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

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


