/*
 * IONOS Cloud - CDN Distribution API
 *
 * This API manages CDN distributions.
 *
 * API version: 1.2.0
 */

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

package cdn

import (
	"encoding/json"
)

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

// IpAddresses The IP addresses of the distribution. Note that the IP addresses will be included in the response only when the CDN distribution is in the 'AVAILABLE' state.
type IpAddresses struct {
	// IP of the distribution. It has to be included on the domain DNS Zone as A record.
	PublicEndpointIpv4 *string `json:"publicEndpointIpv4,omitempty"`
	// IP of the distribution, it has to be included on the domain DNS Zone as AAAA record.
	PublicEndpointIpv6 *string `json:"publicEndpointIpv6,omitempty"`
}

// NewIpAddresses instantiates a new IpAddresses 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 NewIpAddresses() *IpAddresses {
	this := IpAddresses{}

	return &this
}

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

// GetPublicEndpointIpv4 returns the PublicEndpointIpv4 field value if set, zero value otherwise.
func (o *IpAddresses) GetPublicEndpointIpv4() string {
	if o == nil || IsNil(o.PublicEndpointIpv4) {
		var ret string
		return ret
	}
	return *o.PublicEndpointIpv4
}

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

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

	return false
}

// SetPublicEndpointIpv4 gets a reference to the given string and assigns it to the PublicEndpointIpv4 field.
func (o *IpAddresses) SetPublicEndpointIpv4(v string) {
	o.PublicEndpointIpv4 = &v
}

// GetPublicEndpointIpv6 returns the PublicEndpointIpv6 field value if set, zero value otherwise.
func (o *IpAddresses) GetPublicEndpointIpv6() string {
	if o == nil || IsNil(o.PublicEndpointIpv6) {
		var ret string
		return ret
	}
	return *o.PublicEndpointIpv6
}

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

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

	return false
}

// SetPublicEndpointIpv6 gets a reference to the given string and assigns it to the PublicEndpointIpv6 field.
func (o *IpAddresses) SetPublicEndpointIpv6(v string) {
	o.PublicEndpointIpv6 = &v
}

func (o IpAddresses) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.PublicEndpointIpv4) {
		toSerialize["publicEndpointIpv4"] = o.PublicEndpointIpv4
	}
	if !IsNil(o.PublicEndpointIpv6) {
		toSerialize["publicEndpointIpv6"] = o.PublicEndpointIpv6
	}
	return toSerialize, nil
}

type NullableIpAddresses struct {
	value *IpAddresses
	isSet bool
}

func (v NullableIpAddresses) Get() *IpAddresses {
	return v.value
}

func (v *NullableIpAddresses) Set(val *IpAddresses) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableIpAddresses(val *IpAddresses) *NullableIpAddresses {
	return &NullableIpAddresses{value: val, isSet: true}
}

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

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