/*
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 DomainResponseWithResult type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DomainResponseWithResult{}

// DomainResponseWithResult struct for DomainResponseWithResult
type DomainResponseWithResult struct {
	Count *int64 `json:"count,omitempty"`
	Links *DomainLinks `json:"links,omitempty"`
	Results DomainEntityResponse `json:"results"`
	TotalPages *int64 `json:"total_pages,omitempty"`
	SchemaVersion int64 `json:"schema_version"`
}

type _DomainResponseWithResult DomainResponseWithResult

// NewDomainResponseWithResult instantiates a new DomainResponseWithResult 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 NewDomainResponseWithResult(results DomainEntityResponse, schemaVersion int64) *DomainResponseWithResult {
	this := DomainResponseWithResult{}
	this.Results = results
	this.SchemaVersion = schemaVersion
	return &this
}

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

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

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

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

	return false
}

// SetCount gets a reference to the given int64 and assigns it to the Count field.
func (o *DomainResponseWithResult) SetCount(v int64) {
	o.Count = &v
}

// GetLinks returns the Links field value if set, zero value otherwise.
func (o *DomainResponseWithResult) GetLinks() DomainLinks {
	if o == nil || IsNil(o.Links) {
		var ret DomainLinks
		return ret
	}
	return *o.Links
}

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

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

	return false
}

// SetLinks gets a reference to the given DomainLinks and assigns it to the Links field.
func (o *DomainResponseWithResult) SetLinks(v DomainLinks) {
	o.Links = &v
}

// GetResults returns the Results field value
func (o *DomainResponseWithResult) GetResults() DomainEntityResponse {
	if o == nil {
		var ret DomainEntityResponse
		return ret
	}

	return o.Results
}

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

// SetResults sets field value
func (o *DomainResponseWithResult) SetResults(v DomainEntityResponse) {
	o.Results = v
}

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

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

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

	return false
}

// SetTotalPages gets a reference to the given int64 and assigns it to the TotalPages field.
func (o *DomainResponseWithResult) SetTotalPages(v int64) {
	o.TotalPages = &v
}

// GetSchemaVersion returns the SchemaVersion field value
func (o *DomainResponseWithResult) GetSchemaVersion() int64 {
	if o == nil {
		var ret int64
		return ret
	}

	return o.SchemaVersion
}

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

// SetSchemaVersion sets field value
func (o *DomainResponseWithResult) SetSchemaVersion(v int64) {
	o.SchemaVersion = v
}

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

func (o DomainResponseWithResult) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Count) {
		toSerialize["count"] = o.Count
	}
	if !IsNil(o.Links) {
		toSerialize["links"] = o.Links
	}
	toSerialize["results"] = o.Results
	if !IsNil(o.TotalPages) {
		toSerialize["total_pages"] = o.TotalPages
	}
	toSerialize["schema_version"] = o.SchemaVersion
	return toSerialize, nil
}

func (o *DomainResponseWithResult) 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{
		"results",
		"schema_version",
	}

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

	varDomainResponseWithResult := _DomainResponseWithResult{}

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

	if err != nil {
		return err
	}

	*o = DomainResponseWithResult(varDomainResponseWithResult)

	return err
}

type NullableDomainResponseWithResult struct {
	value *DomainResponseWithResult
	isSet bool
}

func (v NullableDomainResponseWithResult) Get() *DomainResponseWithResult {
	return v.value
}

func (v *NullableDomainResponseWithResult) Set(val *DomainResponseWithResult) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDomainResponseWithResult(val *DomainResponseWithResult) *NullableDomainResponseWithResult {
	return &NullableDomainResponseWithResult{value: val, isSet: true}
}

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

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


