/*
 * IONOS DBaaS PostgreSQL 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 PostgreSQL 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: 1.0.0
 */

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

package ionoscloud

import (
	"encoding/json"
)

// ConnectionPooler Configuration options for the connection pooler
type ConnectionPooler struct {
	Enabled  *bool     `json:"enabled,omitempty"`
	PoolMode *PoolMode `json:"poolMode,omitempty"`
}

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

	return &this
}

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

// GetEnabled returns the Enabled field value
// If the value is explicit nil, the zero value for bool will be returned
func (o *ConnectionPooler) GetEnabled() *bool {
	if o == nil {
		return nil
	}

	return o.Enabled

}

// GetEnabledOk returns a tuple with the Enabled 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 *ConnectionPooler) GetEnabledOk() (*bool, bool) {
	if o == nil {
		return nil, false
	}

	return o.Enabled, true
}

// SetEnabled sets field value
func (o *ConnectionPooler) SetEnabled(v bool) {

	o.Enabled = &v

}

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

	return false
}

// GetPoolMode returns the PoolMode field value
// If the value is explicit nil, the zero value for PoolMode will be returned
func (o *ConnectionPooler) GetPoolMode() *PoolMode {
	if o == nil {
		return nil
	}

	return o.PoolMode

}

// GetPoolModeOk returns a tuple with the PoolMode 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 *ConnectionPooler) GetPoolModeOk() (*PoolMode, bool) {
	if o == nil {
		return nil, false
	}

	return o.PoolMode, true
}

// SetPoolMode sets field value
func (o *ConnectionPooler) SetPoolMode(v PoolMode) {

	o.PoolMode = &v

}

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

	return false
}

func (o ConnectionPooler) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Enabled != nil {
		toSerialize["enabled"] = o.Enabled
	}

	if o.PoolMode != nil {
		toSerialize["poolMode"] = o.PoolMode
	}

	return json.Marshal(toSerialize)
}

type NullableConnectionPooler struct {
	value *ConnectionPooler
	isSet bool
}

func (v NullableConnectionPooler) Get() *ConnectionPooler {
	return v.value
}

func (v *NullableConnectionPooler) Set(val *ConnectionPooler) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableConnectionPooler(val *ConnectionPooler) *NullableConnectionPooler {
	return &NullableConnectionPooler{value: val, isSet: true}
}

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

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