/*
 * In-Memory DB API
 *
 * API description for the IONOS In-Memory DB
 *
 * API version: 1.0.0
 * Contact: support@cloud.ionos.com
 */

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

package ionoscloud

import (
	"encoding/json"
)

// ReplicaSet Properties with all data needed to create a new In-Memory DB replication.
type ReplicaSet struct {
	// The human readable name of your replica set.
	DisplayName *string `json:"displayName"`
	// The In-Memory DB version of your replica set.
	Version *string `json:"version"`
	// The total number of replicas in the replica set (one active and n-1 passive). In case of a standalone instance, the value is 1. In all other cases, the value is >1. The replicas will not be available as read replicas, they are only standby for a failure of the active instance.
	Replicas        *int32           `json:"replicas"`
	Resources       *Resources       `json:"resources"`
	PersistenceMode *PersistenceMode `json:"persistenceMode"`
	EvictionPolicy  *EvictionPolicy  `json:"evictionPolicy"`
	// The network connection for your replica set. Only one connection is allowed.
	Connections       *[]Connection      `json:"connections"`
	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
	Credentials       *User              `json:"credentials"`
	// The ID of a snapshot to restore the replica set from. If set, the replica set will be created from the snapshot.
	InitialSnapshotId *string `json:"initialSnapshotId,omitempty"`
}

// NewReplicaSet instantiates a new ReplicaSet 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 NewReplicaSet(displayName string, version string, replicas int32, resources Resources, persistenceMode PersistenceMode, evictionPolicy EvictionPolicy, connections []Connection, credentials User) *ReplicaSet {
	this := ReplicaSet{}

	this.DisplayName = &displayName
	this.Version = &version
	this.Replicas = &replicas
	this.Resources = &resources
	this.PersistenceMode = &persistenceMode
	this.EvictionPolicy = &evictionPolicy
	this.Connections = &connections
	this.Credentials = &credentials

	return &this
}

// NewReplicaSetWithDefaults instantiates a new ReplicaSet 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 NewReplicaSetWithDefaults() *ReplicaSet {
	this := ReplicaSet{}
	var persistenceMode PersistenceMode = PERSISTENCEMODE_NONE
	this.PersistenceMode = &persistenceMode
	var evictionPolicy EvictionPolicy = EVICTIONPOLICY_ALLKEYS_LRU
	this.EvictionPolicy = &evictionPolicy
	return &this
}

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

	return o.DisplayName

}

// GetDisplayNameOk returns a tuple with the DisplayName 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 *ReplicaSet) GetDisplayNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.DisplayName, true
}

// SetDisplayName sets field value
func (o *ReplicaSet) SetDisplayName(v string) {

	o.DisplayName = &v

}

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

	return false
}

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

	return o.Version

}

// GetVersionOk returns a tuple with the Version 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 *ReplicaSet) GetVersionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Version, true
}

// SetVersion sets field value
func (o *ReplicaSet) SetVersion(v string) {

	o.Version = &v

}

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

	return false
}

// GetReplicas returns the Replicas field value
// If the value is explicit nil, the zero value for int32 will be returned
func (o *ReplicaSet) GetReplicas() *int32 {
	if o == nil {
		return nil
	}

	return o.Replicas

}

// GetReplicasOk returns a tuple with the Replicas 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 *ReplicaSet) GetReplicasOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Replicas, true
}

// SetReplicas sets field value
func (o *ReplicaSet) SetReplicas(v int32) {

	o.Replicas = &v

}

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

	return false
}

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

	return o.Resources

}

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

	return o.Resources, true
}

// SetResources sets field value
func (o *ReplicaSet) SetResources(v Resources) {

	o.Resources = &v

}

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

	return false
}

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

	return o.PersistenceMode

}

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

	return o.PersistenceMode, true
}

// SetPersistenceMode sets field value
func (o *ReplicaSet) SetPersistenceMode(v PersistenceMode) {

	o.PersistenceMode = &v

}

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

	return false
}

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

	return o.EvictionPolicy

}

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

	return o.EvictionPolicy, true
}

// SetEvictionPolicy sets field value
func (o *ReplicaSet) SetEvictionPolicy(v EvictionPolicy) {

	o.EvictionPolicy = &v

}

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

	return false
}

// GetConnections returns the Connections field value
// If the value is explicit nil, the zero value for []Connection will be returned
func (o *ReplicaSet) GetConnections() *[]Connection {
	if o == nil {
		return nil
	}

	return o.Connections

}

// GetConnectionsOk returns a tuple with the Connections 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 *ReplicaSet) GetConnectionsOk() (*[]Connection, bool) {
	if o == nil {
		return nil, false
	}

	return o.Connections, true
}

// SetConnections sets field value
func (o *ReplicaSet) SetConnections(v []Connection) {

	o.Connections = &v

}

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

	return false
}

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

	return o.MaintenanceWindow

}

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

	return o.MaintenanceWindow, true
}

// SetMaintenanceWindow sets field value
func (o *ReplicaSet) SetMaintenanceWindow(v MaintenanceWindow) {

	o.MaintenanceWindow = &v

}

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

	return false
}

// GetCredentials returns the Credentials field value
// If the value is explicit nil, the zero value for User will be returned
func (o *ReplicaSet) GetCredentials() *User {
	if o == nil {
		return nil
	}

	return o.Credentials

}

// GetCredentialsOk returns a tuple with the Credentials 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 *ReplicaSet) GetCredentialsOk() (*User, bool) {
	if o == nil {
		return nil, false
	}

	return o.Credentials, true
}

// SetCredentials sets field value
func (o *ReplicaSet) SetCredentials(v User) {

	o.Credentials = &v

}

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

	return false
}

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

	return o.InitialSnapshotId

}

// GetInitialSnapshotIdOk returns a tuple with the InitialSnapshotId 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 *ReplicaSet) GetInitialSnapshotIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.InitialSnapshotId, true
}

// SetInitialSnapshotId sets field value
func (o *ReplicaSet) SetInitialSnapshotId(v string) {

	o.InitialSnapshotId = &v

}

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

	return false
}

func (o ReplicaSet) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.DisplayName != nil {
		toSerialize["displayName"] = o.DisplayName
	}

	if o.Version != nil {
		toSerialize["version"] = o.Version
	}

	if o.Replicas != nil {
		toSerialize["replicas"] = o.Replicas
	}

	if o.Resources != nil {
		toSerialize["resources"] = o.Resources
	}

	if o.PersistenceMode != nil {
		toSerialize["persistenceMode"] = o.PersistenceMode
	}

	if o.EvictionPolicy != nil {
		toSerialize["evictionPolicy"] = o.EvictionPolicy
	}

	if o.Connections != nil {
		toSerialize["connections"] = o.Connections
	}

	if o.MaintenanceWindow != nil {
		toSerialize["maintenanceWindow"] = o.MaintenanceWindow
	}

	if o.Credentials != nil {
		toSerialize["credentials"] = o.Credentials
	}

	if o.InitialSnapshotId != nil {
		toSerialize["initialSnapshotId"] = o.InitialSnapshotId
	}

	return json.Marshal(toSerialize)
}

type NullableReplicaSet struct {
	value *ReplicaSet
	isSet bool
}

func (v NullableReplicaSet) Get() *ReplicaSet {
	return v.value
}

func (v *NullableReplicaSet) Set(val *ReplicaSet) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableReplicaSet(val *ReplicaSet) *NullableReplicaSet {
	return &NullableReplicaSet{value: val, isSet: true}
}

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

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