/*
DM OpenAPI DOC

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: 6.0.0
*/

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

package dm

import (
	"encoding/json"
)

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

// Purge relay log cleanup policy configuration
type Purge struct {
	// expiration time of relay log
	Expires NullableInt64 `json:"expires,omitempty"`
	// The interval to periodically check if the relay log is expired, default value: 3600, in seconds
	Interval NullableInt64 `json:"interval,omitempty"`
	// Minimum free disk space, in GB
	RemainSpace NullableInt64 `json:"remain_space,omitempty"`
}

// NewPurge instantiates a new Purge 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 NewPurge() *Purge {
	this := Purge{}
	var expires int64 = 0
	this.Expires = *NewNullableInt64(&expires)
	var interval int64 = 3600
	this.Interval = *NewNullableInt64(&interval)
	var remainSpace int64 = 15
	this.RemainSpace = *NewNullableInt64(&remainSpace)
	return &this
}

// NewPurgeWithDefaults instantiates a new Purge 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 NewPurgeWithDefaults() *Purge {
	this := Purge{}
	var expires int64 = 0
	this.Expires = *NewNullableInt64(&expires)
	var interval int64 = 3600
	this.Interval = *NewNullableInt64(&interval)
	var remainSpace int64 = 15
	this.RemainSpace = *NewNullableInt64(&remainSpace)
	return &this
}

// GetExpires returns the Expires field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Purge) GetExpires() int64 {
	if o == nil || IsNil(o.Expires.Get()) {
		var ret int64
		return ret
	}
	return *o.Expires.Get()
}

// GetExpiresOk returns a tuple with the Expires field value if set, nil otherwise
// 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 *Purge) GetExpiresOk() (*int64, bool) {
	if o == nil {
		return nil, false
	}
	return o.Expires.Get(), o.Expires.IsSet()
}

// HasExpires returns a boolean if a field has been set.
func (o *Purge) HasExpires() bool {
	if o != nil && o.Expires.IsSet() {
		return true
	}

	return false
}

// SetExpires gets a reference to the given NullableInt64 and assigns it to the Expires field.
func (o *Purge) SetExpires(v int64) {
	o.Expires.Set(&v)
}

// SetExpiresNil sets the value for Expires to be an explicit nil
func (o *Purge) SetExpiresNil() {
	o.Expires.Set(nil)
}

// UnsetExpires ensures that no value is present for Expires, not even an explicit nil
func (o *Purge) UnsetExpires() {
	o.Expires.Unset()
}

// GetInterval returns the Interval field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Purge) GetInterval() int64 {
	if o == nil || IsNil(o.Interval.Get()) {
		var ret int64
		return ret
	}
	return *o.Interval.Get()
}

// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise
// 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 *Purge) GetIntervalOk() (*int64, bool) {
	if o == nil {
		return nil, false
	}
	return o.Interval.Get(), o.Interval.IsSet()
}

// HasInterval returns a boolean if a field has been set.
func (o *Purge) HasInterval() bool {
	if o != nil && o.Interval.IsSet() {
		return true
	}

	return false
}

// SetInterval gets a reference to the given NullableInt64 and assigns it to the Interval field.
func (o *Purge) SetInterval(v int64) {
	o.Interval.Set(&v)
}

// SetIntervalNil sets the value for Interval to be an explicit nil
func (o *Purge) SetIntervalNil() {
	o.Interval.Set(nil)
}

// UnsetInterval ensures that no value is present for Interval, not even an explicit nil
func (o *Purge) UnsetInterval() {
	o.Interval.Unset()
}

// GetRemainSpace returns the RemainSpace field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Purge) GetRemainSpace() int64 {
	if o == nil || IsNil(o.RemainSpace.Get()) {
		var ret int64
		return ret
	}
	return *o.RemainSpace.Get()
}

// GetRemainSpaceOk returns a tuple with the RemainSpace field value if set, nil otherwise
// 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 *Purge) GetRemainSpaceOk() (*int64, bool) {
	if o == nil {
		return nil, false
	}
	return o.RemainSpace.Get(), o.RemainSpace.IsSet()
}

// HasRemainSpace returns a boolean if a field has been set.
func (o *Purge) HasRemainSpace() bool {
	if o != nil && o.RemainSpace.IsSet() {
		return true
	}

	return false
}

// SetRemainSpace gets a reference to the given NullableInt64 and assigns it to the RemainSpace field.
func (o *Purge) SetRemainSpace(v int64) {
	o.RemainSpace.Set(&v)
}

// SetRemainSpaceNil sets the value for RemainSpace to be an explicit nil
func (o *Purge) SetRemainSpaceNil() {
	o.RemainSpace.Set(nil)
}

// UnsetRemainSpace ensures that no value is present for RemainSpace, not even an explicit nil
func (o *Purge) UnsetRemainSpace() {
	o.RemainSpace.Unset()
}

func (o Purge) MarshalJSON() ([]byte, error) {
	toSerialize, err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o Purge) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if o.Expires.IsSet() {
		toSerialize["expires"] = o.Expires.Get()
	}
	if o.Interval.IsSet() {
		toSerialize["interval"] = o.Interval.Get()
	}
	if o.RemainSpace.IsSet() {
		toSerialize["remain_space"] = o.RemainSpace.Get()
	}
	return toSerialize, nil
}

type NullablePurge struct {
	value *Purge
	isSet bool
}

func (v NullablePurge) Get() *Purge {
	return v.value
}

func (v *NullablePurge) Set(val *Purge) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePurge(val *Purge) *NullablePurge {
	return &NullablePurge{value: val, isSet: true}
}

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

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