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

// DistributionProperties A CDN distribution resource.
type DistributionProperties struct {
	// The domain of the distribution.
	Domain string `json:"domain"`
	// The ID of the certificate to use for the distribution.
	CertificateId *string `json:"certificateId,omitempty"`
	// The routing rules for the distribution.
	RoutingRules []RoutingRule `json:"routingRules"`
}

// NewDistributionProperties instantiates a new DistributionProperties 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 NewDistributionProperties(domain string, routingRules []RoutingRule) *DistributionProperties {
	this := DistributionProperties{}

	this.Domain = domain
	this.RoutingRules = routingRules

	return &this
}

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

// GetDomain returns the Domain field value
func (o *DistributionProperties) GetDomain() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Domain
}

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

// SetDomain sets field value
func (o *DistributionProperties) SetDomain(v string) {
	o.Domain = v
}

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

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

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

	return false
}

// SetCertificateId gets a reference to the given string and assigns it to the CertificateId field.
func (o *DistributionProperties) SetCertificateId(v string) {
	o.CertificateId = &v
}

// GetRoutingRules returns the RoutingRules field value
func (o *DistributionProperties) GetRoutingRules() []RoutingRule {
	if o == nil {
		var ret []RoutingRule
		return ret
	}

	return o.RoutingRules
}

// GetRoutingRulesOk returns a tuple with the RoutingRules field value
// and a boolean to check if the value has been set.
func (o *DistributionProperties) GetRoutingRulesOk() ([]RoutingRule, bool) {
	if o == nil {
		return nil, false
	}
	return o.RoutingRules, true
}

// SetRoutingRules sets field value
func (o *DistributionProperties) SetRoutingRules(v []RoutingRule) {
	o.RoutingRules = v
}

func (o DistributionProperties) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["domain"] = o.Domain
	if !IsNil(o.CertificateId) {
		toSerialize["certificateId"] = o.CertificateId
	}
	toSerialize["routingRules"] = o.RoutingRules
	return toSerialize, nil
}

type NullableDistributionProperties struct {
	value *DistributionProperties
	isSet bool
}

func (v NullableDistributionProperties) Get() *DistributionProperties {
	return v.value
}

func (v *NullableDistributionProperties) Set(val *DistributionProperties) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDistributionProperties(val *DistributionProperties) *NullableDistributionProperties {
	return &NullableDistributionProperties{value: val, isSet: true}
}

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

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