/*
Merlin

API Guide for accessing Merlin's model management, deployment, and serving functionalities

API version: 0.14.0
*/

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

package client

import (
	"encoding/json"
)

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

// ModelEndpointRule struct for ModelEndpointRule
type ModelEndpointRule struct {
	Destinations []ModelEndpointRuleDestination `json:"destinations,omitempty"`
	Mirror       *VersionEndpoint               `json:"mirror,omitempty"`
}

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

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

// GetDestinations returns the Destinations field value if set, zero value otherwise.
func (o *ModelEndpointRule) GetDestinations() []ModelEndpointRuleDestination {
	if o == nil || IsNil(o.Destinations) {
		var ret []ModelEndpointRuleDestination
		return ret
	}
	return o.Destinations
}

// GetDestinationsOk returns a tuple with the Destinations field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ModelEndpointRule) GetDestinationsOk() ([]ModelEndpointRuleDestination, bool) {
	if o == nil || IsNil(o.Destinations) {
		return nil, false
	}
	return o.Destinations, true
}

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

	return false
}

// SetDestinations gets a reference to the given []ModelEndpointRuleDestination and assigns it to the Destinations field.
func (o *ModelEndpointRule) SetDestinations(v []ModelEndpointRuleDestination) {
	o.Destinations = v
}

// GetMirror returns the Mirror field value if set, zero value otherwise.
func (o *ModelEndpointRule) GetMirror() VersionEndpoint {
	if o == nil || IsNil(o.Mirror) {
		var ret VersionEndpoint
		return ret
	}
	return *o.Mirror
}

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

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

	return false
}

// SetMirror gets a reference to the given VersionEndpoint and assigns it to the Mirror field.
func (o *ModelEndpointRule) SetMirror(v VersionEndpoint) {
	o.Mirror = &v
}

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

func (o ModelEndpointRule) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Destinations) {
		toSerialize["destinations"] = o.Destinations
	}
	if !IsNil(o.Mirror) {
		toSerialize["mirror"] = o.Mirror
	}
	return toSerialize, nil
}

type NullableModelEndpointRule struct {
	value *ModelEndpointRule
	isSet bool
}

func (v NullableModelEndpointRule) Get() *ModelEndpointRule {
	return v.value
}

func (v *NullableModelEndpointRule) Set(val *ModelEndpointRule) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableModelEndpointRule(val *ModelEndpointRule) *NullableModelEndpointRule {
	return &NullableModelEndpointRule{value: val, isSet: true}
}

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

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