/*
 * 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"
	"time"
)

// ClusterBackup A backup object.
type ClusterBackup struct {
	// The unique ID of the resource.
	Id *string `json:"id,omitempty"`
	// The unique ID of the cluster.
	ClusterId *string `json:"clusterId,omitempty"`
	// The PostgreSQL version this backup was created from.
	Version *string `json:"version,omitempty"`
	// Whether a cluster currently backs up data to this backup.
	IsActive *bool `json:"isActive,omitempty"`
	// The oldest available timestamp to which you can restore.
	EarliestRecoveryTargetTime *IonosTime `json:"earliestRecoveryTargetTime,omitempty"`
	// Size of all base backups including the wal size in MB.
	Size *int32 `json:"size,omitempty"`
	// The S3 location where the backups will be stored.
	Location *string `json:"location,omitempty"`
}

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

	return &this
}

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

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

	return o.Id

}

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

	return o.Id, true
}

// SetId sets field value
func (o *ClusterBackup) SetId(v string) {

	o.Id = &v

}

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

	return false
}

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

	return o.ClusterId

}

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

	return o.ClusterId, true
}

// SetClusterId sets field value
func (o *ClusterBackup) SetClusterId(v string) {

	o.ClusterId = &v

}

// HasClusterId returns a boolean if a field has been set.
func (o *ClusterBackup) HasClusterId() bool {
	if o != nil && o.ClusterId != 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 *ClusterBackup) 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 *ClusterBackup) GetVersionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Version, true
}

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

	o.Version = &v

}

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

	return false
}

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

	return o.IsActive

}

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

	return o.IsActive, true
}

// SetIsActive sets field value
func (o *ClusterBackup) SetIsActive(v bool) {

	o.IsActive = &v

}

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

	return false
}

// GetEarliestRecoveryTargetTime returns the EarliestRecoveryTargetTime field value
// If the value is explicit nil, the zero value for time.Time will be returned
func (o *ClusterBackup) GetEarliestRecoveryTargetTime() *time.Time {
	if o == nil {
		return nil
	}

	if o.EarliestRecoveryTargetTime == nil {
		return nil
	}
	return &o.EarliestRecoveryTargetTime.Time

}

// GetEarliestRecoveryTargetTimeOk returns a tuple with the EarliestRecoveryTargetTime 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 *ClusterBackup) GetEarliestRecoveryTargetTimeOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}

	if o.EarliestRecoveryTargetTime == nil {
		return nil, false
	}
	return &o.EarliestRecoveryTargetTime.Time, true

}

// SetEarliestRecoveryTargetTime sets field value
func (o *ClusterBackup) SetEarliestRecoveryTargetTime(v time.Time) {

	o.EarliestRecoveryTargetTime = &IonosTime{v}

}

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

	return false
}

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

	return o.Size

}

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

	return o.Size, true
}

// SetSize sets field value
func (o *ClusterBackup) SetSize(v int32) {

	o.Size = &v

}

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

	return false
}

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

	return o.Location

}

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

	return o.Location, true
}

// SetLocation sets field value
func (o *ClusterBackup) SetLocation(v string) {

	o.Location = &v

}

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

	return false
}

func (o ClusterBackup) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Id != nil {
		toSerialize["id"] = o.Id
	}

	if o.ClusterId != nil {
		toSerialize["clusterId"] = o.ClusterId
	}

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

	if o.IsActive != nil {
		toSerialize["isActive"] = o.IsActive
	}

	if o.EarliestRecoveryTargetTime != nil {
		toSerialize["earliestRecoveryTargetTime"] = o.EarliestRecoveryTargetTime
	}

	if o.Size != nil {
		toSerialize["size"] = o.Size
	}

	if o.Location != nil {
		toSerialize["location"] = o.Location
	}

	return json.Marshal(toSerialize)
}

type NullableClusterBackup struct {
	value *ClusterBackup
	isSet bool
}

func (v NullableClusterBackup) Get() *ClusterBackup {
	return v.value
}

func (v *NullableClusterBackup) Set(val *ClusterBackup) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableClusterBackup(val *ClusterBackup) *NullableClusterBackup {
	return &NullableClusterBackup{value: val, isSet: true}
}

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

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