/*
 * IONOS DBaaS MariaDB REST API
 *
 * An enterprise-grade Database is provided as a Service (DBaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API.  The API allows you to create additional MariaDB database clusters or modify existing ones. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive.
 *
 * API version: 0.1.0
 */

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

package ionoscloud

import (
	"encoding/json"
)

// Connection Details about the network connection for your cluster.
type Connection struct {
	// The datacenter to connect your cluster to.
	DatacenterId *string `json:"datacenterId"`
	// The numeric LAN ID to connect your cluster to.
	LanId *string `json:"lanId"`
	// The IP and subnet for your cluster. Note the following unavailable IP ranges: 10.233.64.0/18 10.233.0.0/18 10.233.114.0/24
	Cidr *string `json:"cidr"`
}

// NewConnection instantiates a new Connection 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 NewConnection(datacenterId string, lanId string, cidr string) *Connection {
	this := Connection{}

	this.DatacenterId = &datacenterId
	this.LanId = &lanId
	this.Cidr = &cidr

	return &this
}

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

// GetDatacenterId returns the DatacenterId field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Connection) GetDatacenterId() *string {
	if o == nil {
		return nil
	}

	return o.DatacenterId

}

// GetDatacenterIdOk returns a tuple with the DatacenterId field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Connection) GetDatacenterIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.DatacenterId, true
}

// SetDatacenterId sets field value
func (o *Connection) SetDatacenterId(v string) {

	o.DatacenterId = &v

}

// HasDatacenterId returns a boolean if a field has been set.
func (o *Connection) HasDatacenterId() bool {
	if o != nil && o.DatacenterId != nil {
		return true
	}

	return false
}

// GetLanId returns the LanId field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Connection) GetLanId() *string {
	if o == nil {
		return nil
	}

	return o.LanId

}

// GetLanIdOk returns a tuple with the LanId field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Connection) GetLanIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.LanId, true
}

// SetLanId sets field value
func (o *Connection) SetLanId(v string) {

	o.LanId = &v

}

// HasLanId returns a boolean if a field has been set.
func (o *Connection) HasLanId() bool {
	if o != nil && o.LanId != nil {
		return true
	}

	return false
}

// GetCidr returns the Cidr field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Connection) GetCidr() *string {
	if o == nil {
		return nil
	}

	return o.Cidr

}

// GetCidrOk returns a tuple with the Cidr field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Connection) GetCidrOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Cidr, true
}

// SetCidr sets field value
func (o *Connection) SetCidr(v string) {

	o.Cidr = &v

}

// HasCidr returns a boolean if a field has been set.
func (o *Connection) HasCidr() bool {
	if o != nil && o.Cidr != nil {
		return true
	}

	return false
}

func (o Connection) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.DatacenterId != nil {
		toSerialize["datacenterId"] = o.DatacenterId
	}

	if o.LanId != nil {
		toSerialize["lanId"] = o.LanId
	}

	if o.Cidr != nil {
		toSerialize["cidr"] = o.Cidr
	}

	return json.Marshal(toSerialize)
}

type NullableConnection struct {
	value *Connection
	isSet bool
}

func (v NullableConnection) Get() *Connection {
	return v.value
}

func (v *NullableConnection) Set(val *Connection) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableConnection(val *Connection) *NullableConnection {
	return &NullableConnection{value: val, isSet: true}
}

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

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