/*
 * VPN Gateways
 *
 * POC Docs for VPN gateway as service
 *
 * API version: 0.0.1
 * Contact: support@cloud.ionos.com
 */

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

package vpn

import (
	"encoding/json"
)

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

// IPSecGateway Properties with all data needed to create a new IPSec Gateway.
type IPSecGateway struct {
	// The human readable name of your IPSecGateway.
	Name string `json:"name"`
	// Human readable description of the IPSecGateway.
	Description *string `json:"description,omitempty"`
	// Public IP address to be assigned to the gateway. __Note__: This must be an IP address in the same datacenter as the connections.
	GatewayIP string `json:"gatewayIP"`
	// The network connection for your gateway. __Note__: all connections must belong to the same datacenterId.
	Connections []Connection `json:"connections"`
	// The IKE version that is permitted for the VPN tunnels.\\ Options:  - IKEv2
	Version *string `json:"version,omitempty"`
}

// NewIPSecGateway instantiates a new IPSecGateway 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 NewIPSecGateway(name string, gatewayIP string, connections []Connection) *IPSecGateway {
	this := IPSecGateway{}

	this.Name = name
	this.GatewayIP = gatewayIP
	this.Connections = connections
	var version string = "IKEv2"
	this.Version = &version

	return &this
}

// NewIPSecGatewayWithDefaults instantiates a new IPSecGateway 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 NewIPSecGatewayWithDefaults() *IPSecGateway {
	this := IPSecGateway{}
	var version string = "IKEv2"
	this.Version = &version
	return &this
}

// GetName returns the Name field value
func (o *IPSecGateway) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *IPSecGateway) SetName(v string) {
	o.Name = v
}

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

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

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

	return false
}

// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *IPSecGateway) SetDescription(v string) {
	o.Description = &v
}

// GetGatewayIP returns the GatewayIP field value
func (o *IPSecGateway) GetGatewayIP() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.GatewayIP
}

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

// SetGatewayIP sets field value
func (o *IPSecGateway) SetGatewayIP(v string) {
	o.GatewayIP = v
}

// GetConnections returns the Connections field value
func (o *IPSecGateway) GetConnections() []Connection {
	if o == nil {
		var ret []Connection
		return ret
	}

	return o.Connections
}

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

// SetConnections sets field value
func (o *IPSecGateway) SetConnections(v []Connection) {
	o.Connections = v
}

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

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

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

	return false
}

// SetVersion gets a reference to the given string and assigns it to the Version field.
func (o *IPSecGateway) SetVersion(v string) {
	o.Version = &v
}

func (o IPSecGateway) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["name"] = o.Name
	if !IsNil(o.Description) {
		toSerialize["description"] = o.Description
	}
	toSerialize["gatewayIP"] = o.GatewayIP
	toSerialize["connections"] = o.Connections
	if !IsNil(o.Version) {
		toSerialize["version"] = o.Version
	}
	return toSerialize, nil
}

type NullableIPSecGateway struct {
	value *IPSecGateway
	isSet bool
}

func (v NullableIPSecGateway) Get() *IPSecGateway {
	return v.value
}

func (v *NullableIPSecGateway) Set(val *IPSecGateway) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableIPSecGateway(val *IPSecGateway) *NullableIPSecGateway {
	return &NullableIPSecGateway{value: val, isSet: true}
}

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

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