/*
 * 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"

	"time"
)

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

// DistributionMetadata struct for DistributionMetadata
type DistributionMetadata struct {
	// The ISO 8601 creation timestamp.
	CreatedDate *IonosTime `json:"createdDate,omitempty"`
	// Unique name of the identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`
	// Unique id of the identity that created the resource.
	CreatedByUserId *string `json:"createdByUserId,omitempty"`
	// The ISO 8601 modified timestamp.
	LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"`
	// Unique name of the identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
	// Unique id of the identity that last modified the resource.
	LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"`
	// Unique name of the resource.
	ResourceURN *string `json:"resourceURN,omitempty"`
	// 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"`
	// Represents one of the possible states of the resource.
	State string `json:"state"`
	// A human readable message describing the current state. In case of an error, the message will contain a detailed error message.
	Message *string `json:"message,omitempty"`
}

// NewDistributionMetadata instantiates a new DistributionMetadata 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 NewDistributionMetadata(state string) *DistributionMetadata {
	this := DistributionMetadata{}

	this.State = state

	return &this
}

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

// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise.
func (o *DistributionMetadata) GetCreatedDate() time.Time {
	if o == nil || IsNil(o.CreatedDate) {
		var ret time.Time
		return ret
	}
	return o.CreatedDate.Time
}

// GetCreatedDateOk returns a tuple with the CreatedDate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DistributionMetadata) GetCreatedDateOk() (*time.Time, bool) {
	if o == nil || IsNil(o.CreatedDate) {
		return nil, false
	}
	return &o.CreatedDate.Time, true
}

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

	return false
}

// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field.
func (o *DistributionMetadata) SetCreatedDate(v time.Time) {
	o.CreatedDate = &IonosTime{v}
}

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

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

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

	return false
}

// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field.
func (o *DistributionMetadata) SetCreatedBy(v string) {
	o.CreatedBy = &v
}

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

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

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

	return false
}

// SetCreatedByUserId gets a reference to the given string and assigns it to the CreatedByUserId field.
func (o *DistributionMetadata) SetCreatedByUserId(v string) {
	o.CreatedByUserId = &v
}

// GetLastModifiedDate returns the LastModifiedDate field value if set, zero value otherwise.
func (o *DistributionMetadata) GetLastModifiedDate() time.Time {
	if o == nil || IsNil(o.LastModifiedDate) {
		var ret time.Time
		return ret
	}
	return o.LastModifiedDate.Time
}

// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DistributionMetadata) GetLastModifiedDateOk() (*time.Time, bool) {
	if o == nil || IsNil(o.LastModifiedDate) {
		return nil, false
	}
	return &o.LastModifiedDate.Time, true
}

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

	return false
}

// SetLastModifiedDate gets a reference to the given time.Time and assigns it to the LastModifiedDate field.
func (o *DistributionMetadata) SetLastModifiedDate(v time.Time) {
	o.LastModifiedDate = &IonosTime{v}
}

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

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

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

	return false
}

// SetLastModifiedBy gets a reference to the given string and assigns it to the LastModifiedBy field.
func (o *DistributionMetadata) SetLastModifiedBy(v string) {
	o.LastModifiedBy = &v
}

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

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

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

	return false
}

// SetLastModifiedByUserId gets a reference to the given string and assigns it to the LastModifiedByUserId field.
func (o *DistributionMetadata) SetLastModifiedByUserId(v string) {
	o.LastModifiedByUserId = &v
}

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

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

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

	return false
}

// SetResourceURN gets a reference to the given string and assigns it to the ResourceURN field.
func (o *DistributionMetadata) SetResourceURN(v string) {
	o.ResourceURN = &v
}

// GetPublicEndpointIpv4 returns the PublicEndpointIpv4 field value if set, zero value otherwise.
func (o *DistributionMetadata) 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 *DistributionMetadata) 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 *DistributionMetadata) 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 *DistributionMetadata) SetPublicEndpointIpv4(v string) {
	o.PublicEndpointIpv4 = &v
}

// GetPublicEndpointIpv6 returns the PublicEndpointIpv6 field value if set, zero value otherwise.
func (o *DistributionMetadata) 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 *DistributionMetadata) 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 *DistributionMetadata) 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 *DistributionMetadata) SetPublicEndpointIpv6(v string) {
	o.PublicEndpointIpv6 = &v
}

// GetState returns the State field value
func (o *DistributionMetadata) GetState() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.State
}

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

// SetState sets field value
func (o *DistributionMetadata) SetState(v string) {
	o.State = v
}

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

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

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

	return false
}

// SetMessage gets a reference to the given string and assigns it to the Message field.
func (o *DistributionMetadata) SetMessage(v string) {
	o.Message = &v
}

func (o DistributionMetadata) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.CreatedDate) {
		toSerialize["createdDate"] = o.CreatedDate
	}
	if !IsNil(o.CreatedBy) {
		toSerialize["createdBy"] = o.CreatedBy
	}
	if !IsNil(o.CreatedByUserId) {
		toSerialize["createdByUserId"] = o.CreatedByUserId
	}
	if !IsNil(o.LastModifiedDate) {
		toSerialize["lastModifiedDate"] = o.LastModifiedDate
	}
	if !IsNil(o.LastModifiedBy) {
		toSerialize["lastModifiedBy"] = o.LastModifiedBy
	}
	if !IsNil(o.LastModifiedByUserId) {
		toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId
	}
	if !IsNil(o.ResourceURN) {
		toSerialize["resourceURN"] = o.ResourceURN
	}
	if !IsNil(o.PublicEndpointIpv4) {
		toSerialize["publicEndpointIpv4"] = o.PublicEndpointIpv4
	}
	if !IsNil(o.PublicEndpointIpv6) {
		toSerialize["publicEndpointIpv6"] = o.PublicEndpointIpv6
	}
	toSerialize["state"] = o.State
	if !IsNil(o.Message) {
		toSerialize["message"] = o.Message
	}
	return toSerialize, nil
}

type NullableDistributionMetadata struct {
	value *DistributionMetadata
	isSet bool
}

func (v NullableDistributionMetadata) Get() *DistributionMetadata {
	return v.value
}

func (v *NullableDistributionMetadata) Set(val *DistributionMetadata) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDistributionMetadata(val *DistributionMetadata) *NullableDistributionMetadata {
	return &NullableDistributionMetadata{value: val, isSet: true}
}

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

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