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

// Backup A backup object.
type Backup struct {
	// The unique ID of the cluster that was backed up.
	ClusterId *string `json:"clusterId,omitempty"`
	// The oldest available timestamp to which you can restore.
	EarliestRecoveryTargetTime *IonosTime `json:"earliestRecoveryTargetTime,omitempty"`
	// Size of all base backups in MiB. This is at least the sum of all base backup sizes.
	Size        *int32        `json:"size,omitempty"`
	BaseBackups *[]BaseBackup `json:"baseBackups,omitempty"`
}

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

	return &this
}

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

// GetClusterId returns the ClusterId field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Backup) 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 *Backup) GetClusterIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.ClusterId, true
}

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

	o.ClusterId = &v

}

// HasClusterId returns a boolean if a field has been set.
func (o *Backup) HasClusterId() bool {
	if o != nil && o.ClusterId != 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 *Backup) 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 *Backup) 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 *Backup) SetEarliestRecoveryTargetTime(v time.Time) {

	o.EarliestRecoveryTargetTime = &IonosTime{v}

}

// HasEarliestRecoveryTargetTime returns a boolean if a field has been set.
func (o *Backup) 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 *Backup) 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 *Backup) GetSizeOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Size, true
}

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

	o.Size = &v

}

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

	return false
}

// GetBaseBackups returns the BaseBackups field value
// If the value is explicit nil, the zero value for []BaseBackup will be returned
func (o *Backup) GetBaseBackups() *[]BaseBackup {
	if o == nil {
		return nil
	}

	return o.BaseBackups

}

// GetBaseBackupsOk returns a tuple with the BaseBackups 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 *Backup) GetBaseBackupsOk() (*[]BaseBackup, bool) {
	if o == nil {
		return nil, false
	}

	return o.BaseBackups, true
}

// SetBaseBackups sets field value
func (o *Backup) SetBaseBackups(v []BaseBackup) {

	o.BaseBackups = &v

}

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

	return false
}

func (o Backup) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.ClusterId != nil {
		toSerialize["clusterId"] = o.ClusterId
	}

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

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

	if o.BaseBackups != nil {
		toSerialize["baseBackups"] = o.BaseBackups
	}

	return json.Marshal(toSerialize)
}

type NullableBackup struct {
	value *Backup
	isSet bool
}

func (v NullableBackup) Get() *Backup {
	return v.value
}

func (v *NullableBackup) Set(val *Backup) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBackup(val *Backup) *NullableBackup {
	return &NullableBackup{value: val, isSet: true}
}

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

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