/*
gravity

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

API version: 0.28.1
*/

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

package api

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

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

// DiscoveryAPIDevicesApplyInput struct for DiscoveryAPIDevicesApplyInput
type DiscoveryAPIDevicesApplyInput struct {
	DhcpScope string `json:"dhcpScope"`
	DnsZone   string `json:"dnsZone"`
	To        string `json:"to"`
}

type _DiscoveryAPIDevicesApplyInput DiscoveryAPIDevicesApplyInput

// NewDiscoveryAPIDevicesApplyInput instantiates a new DiscoveryAPIDevicesApplyInput 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 NewDiscoveryAPIDevicesApplyInput(dhcpScope string, dnsZone string, to string) *DiscoveryAPIDevicesApplyInput {
	this := DiscoveryAPIDevicesApplyInput{}
	this.DhcpScope = dhcpScope
	this.DnsZone = dnsZone
	this.To = to
	return &this
}

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

// GetDhcpScope returns the DhcpScope field value
func (o *DiscoveryAPIDevicesApplyInput) GetDhcpScope() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DhcpScope
}

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

// SetDhcpScope sets field value
func (o *DiscoveryAPIDevicesApplyInput) SetDhcpScope(v string) {
	o.DhcpScope = v
}

// GetDnsZone returns the DnsZone field value
func (o *DiscoveryAPIDevicesApplyInput) GetDnsZone() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DnsZone
}

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

// SetDnsZone sets field value
func (o *DiscoveryAPIDevicesApplyInput) SetDnsZone(v string) {
	o.DnsZone = v
}

// GetTo returns the To field value
func (o *DiscoveryAPIDevicesApplyInput) GetTo() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.To
}

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

// SetTo sets field value
func (o *DiscoveryAPIDevicesApplyInput) SetTo(v string) {
	o.To = v
}

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

func (o DiscoveryAPIDevicesApplyInput) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["dhcpScope"] = o.DhcpScope
	toSerialize["dnsZone"] = o.DnsZone
	toSerialize["to"] = o.To
	return toSerialize, nil
}

func (o *DiscoveryAPIDevicesApplyInput) 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{
		"dhcpScope",
		"dnsZone",
		"to",
	}

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

	varDiscoveryAPIDevicesApplyInput := _DiscoveryAPIDevicesApplyInput{}

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

	if err != nil {
		return err
	}

	*o = DiscoveryAPIDevicesApplyInput(varDiscoveryAPIDevicesApplyInput)

	return err
}

type NullableDiscoveryAPIDevicesApplyInput struct {
	value *DiscoveryAPIDevicesApplyInput
	isSet bool
}

func (v NullableDiscoveryAPIDevicesApplyInput) Get() *DiscoveryAPIDevicesApplyInput {
	return v.value
}

func (v *NullableDiscoveryAPIDevicesApplyInput) Set(val *DiscoveryAPIDevicesApplyInput) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDiscoveryAPIDevicesApplyInput(val *DiscoveryAPIDevicesApplyInput) *NullableDiscoveryAPIDevicesApplyInput {
	return &NullableDiscoveryAPIDevicesApplyInput{value: val, isSet: true}
}

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

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