/*
Domain 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 domains

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

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

// DomainLinks struct for DomainLinks
type DomainLinks struct {
	Previous NullableString `json:"previous"`
	Next NullableString `json:"next"`
}

type _DomainLinks DomainLinks

// NewDomainLinks instantiates a new DomainLinks 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 NewDomainLinks(previous NullableString, next NullableString) *DomainLinks {
	this := DomainLinks{}
	this.Previous = previous
	this.Next = next
	return &this
}

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

// GetPrevious returns the Previous field value
// If the value is explicit nil, the zero value for string will be returned
func (o *DomainLinks) GetPrevious() string {
	if o == nil || o.Previous.Get() == nil {
		var ret string
		return ret
	}

	return *o.Previous.Get()
}

// GetPreviousOk returns a tuple with the Previous field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *DomainLinks) GetPreviousOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Previous.Get(), o.Previous.IsSet()
}

// SetPrevious sets field value
func (o *DomainLinks) SetPrevious(v string) {
	o.Previous.Set(&v)
}

// GetNext returns the Next field value
// If the value is explicit nil, the zero value for string will be returned
func (o *DomainLinks) GetNext() string {
	if o == nil || o.Next.Get() == nil {
		var ret string
		return ret
	}

	return *o.Next.Get()
}

// GetNextOk returns a tuple with the Next field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *DomainLinks) GetNextOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Next.Get(), o.Next.IsSet()
}

// SetNext sets field value
func (o *DomainLinks) SetNext(v string) {
	o.Next.Set(&v)
}

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

func (o DomainLinks) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["previous"] = o.Previous.Get()
	toSerialize["next"] = o.Next.Get()
	return toSerialize, nil
}

func (o *DomainLinks) 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{
		"previous",
		"next",
	}

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

	varDomainLinks := _DomainLinks{}

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

	if err != nil {
		return err
	}

	*o = DomainLinks(varDomainLinks)

	return err
}

type NullableDomainLinks struct {
	value *DomainLinks
	isSet bool
}

func (v NullableDomainLinks) Get() *DomainLinks {
	return v.value
}

func (v *NullableDomainLinks) Set(val *DomainLinks) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDomainLinks(val *DomainLinks) *NullableDomainLinks {
	return &NullableDomainLinks{value: val, isSet: true}
}

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

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


