/*
TiDB Cloud Console API

TiDB Cloud Console API.

API version: v1beta1
*/

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

package client

import (
	"encoding/json"
)

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

// V1beta1ClusterAutoScaling Message for auto scaling configuration.
type V1beta1ClusterAutoScaling struct {
	// The maximum number of Request Capacity Units (RCUs) for auto-scaling.
	MaxRcu *int64 `json:"maxRcu,omitempty"`
	// The minimum number of Request Capacity Units (RCUs) for auto-scaling.
	MinRcu *int64 `json:"minRcu,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _V1beta1ClusterAutoScaling V1beta1ClusterAutoScaling

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

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

// GetMaxRcu returns the MaxRcu field value if set, zero value otherwise.
func (o *V1beta1ClusterAutoScaling) GetMaxRcu() int64 {
	if o == nil || IsNil(o.MaxRcu) {
		var ret int64
		return ret
	}
	return *o.MaxRcu
}

// GetMaxRcuOk returns a tuple with the MaxRcu field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *V1beta1ClusterAutoScaling) GetMaxRcuOk() (*int64, bool) {
	if o == nil || IsNil(o.MaxRcu) {
		return nil, false
	}
	return o.MaxRcu, true
}

// HasMaxRcu returns a boolean if a field has been set.
func (o *V1beta1ClusterAutoScaling) HasMaxRcu() bool {
	if o != nil && !IsNil(o.MaxRcu) {
		return true
	}

	return false
}

// SetMaxRcu gets a reference to the given int64 and assigns it to the MaxRcu field.
func (o *V1beta1ClusterAutoScaling) SetMaxRcu(v int64) {
	o.MaxRcu = &v
}

// GetMinRcu returns the MinRcu field value if set, zero value otherwise.
func (o *V1beta1ClusterAutoScaling) GetMinRcu() int64 {
	if o == nil || IsNil(o.MinRcu) {
		var ret int64
		return ret
	}
	return *o.MinRcu
}

// GetMinRcuOk returns a tuple with the MinRcu field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *V1beta1ClusterAutoScaling) GetMinRcuOk() (*int64, bool) {
	if o == nil || IsNil(o.MinRcu) {
		return nil, false
	}
	return o.MinRcu, true
}

// HasMinRcu returns a boolean if a field has been set.
func (o *V1beta1ClusterAutoScaling) HasMinRcu() bool {
	if o != nil && !IsNil(o.MinRcu) {
		return true
	}

	return false
}

// SetMinRcu gets a reference to the given int64 and assigns it to the MinRcu field.
func (o *V1beta1ClusterAutoScaling) SetMinRcu(v int64) {
	o.MinRcu = &v
}

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

func (o V1beta1ClusterAutoScaling) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.MaxRcu) {
		toSerialize["maxRcu"] = o.MaxRcu
	}
	if !IsNil(o.MinRcu) {
		toSerialize["minRcu"] = o.MinRcu
	}

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *V1beta1ClusterAutoScaling) UnmarshalJSON(data []byte) (err error) {
	varV1beta1ClusterAutoScaling := _V1beta1ClusterAutoScaling{}

	err = json.Unmarshal(data, &varV1beta1ClusterAutoScaling)

	if err != nil {
		return err
	}

	*o = V1beta1ClusterAutoScaling(varV1beta1ClusterAutoScaling)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "maxRcu")
		delete(additionalProperties, "minRcu")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableV1beta1ClusterAutoScaling struct {
	value *V1beta1ClusterAutoScaling
	isSet bool
}

func (v NullableV1beta1ClusterAutoScaling) Get() *V1beta1ClusterAutoScaling {
	return v.value
}

func (v *NullableV1beta1ClusterAutoScaling) Set(val *V1beta1ClusterAutoScaling) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableV1beta1ClusterAutoScaling(val *V1beta1ClusterAutoScaling) *NullableV1beta1ClusterAutoScaling {
	return &NullableV1beta1ClusterAutoScaling{value: val, isSet: true}
}

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

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


