/*
 * VM Auto Scaling API
 *
 * The VM Auto Scaling Service enables IONOS clients to horizontally scale the number of VM replicas based on configured rules. You can use VM Auto Scaling to ensure that you have a sufficient number of replicas to handle your application loads at all times.  For this purpose, create a VM Auto Scaling Group that contains the server replicas. The VM Auto Scaling Service ensures that the number of replicas in the group is always within the defined limits.   When scaling policies are set, VM Auto Scaling creates or deletes replicas according to the requirements of your applications. For each policy, specified 'scale-in' and 'scale-out' actions are performed when the corresponding thresholds are reached.
 *
 * API version: 1-SDK.1
 * Contact: support@cloud.ionos.com
 */

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

package ionoscloud

import (
	"encoding/json"
)

// GroupPolicyScaleInAction Defines the action to be taken when the 'scaleInThreshold' is exceeded. Here, scaling is always about removing VMs associated with this VM Auto Scaling Group. By default, the termination policy is 'OLDEST_SERVER_FIRST' is effective.
type GroupPolicyScaleInAction struct {
	// 'amountType=ABSOLUTE' specifies the absolute number of VMs that are added or removed. The value must be between 1 to 10.   'amountType=PERCENTAGE' specifies the percentage value that is applied to the current number of replicas of the VM Auto Scaling Group. The value must be between 1 to 200.   At least one VM is always added or removed.   Note that for 'SCALE_IN' operations, volumes are not deleted after the server is deleted.
	Amount     *float32      `json:"amount"`
	AmountType *ActionAmount `json:"amountType"`
	// The minimum time that elapses after the start of this scaling action until the next scaling action is started. With a scaling action in progress, no second scaling action is started for the same VM Auto Scaling Group. Instead, the metric is re-evaluated after the current scaling action completes (either successfully or with errors). This is currently validated with a minimum value of 2 minutes and a maximum value of 24 hours. The default value is 5 minutes if not specified.
	CooldownPeriod    *string                `json:"cooldownPeriod,omitempty"`
	TerminationPolicy *TerminationPolicyType `json:"terminationPolicy,omitempty"`
	// If set to `true`, when deleting an replica during scale in, any attached volume will also be deleted. When set to `false`, all volumes remain in the datacenter and must be deleted manually.  **Note**, that every scale-out creates new volumes. When they are not deleted, they will eventually use all of your contracts resource limits. At this point, scaling out would not be possible anymore.
	DeleteVolumes *bool `json:"deleteVolumes"`
}

// NewGroupPolicyScaleInAction instantiates a new GroupPolicyScaleInAction 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 NewGroupPolicyScaleInAction(amount float32, amountType ActionAmount, deleteVolumes bool) *GroupPolicyScaleInAction {
	this := GroupPolicyScaleInAction{}

	this.Amount = &amount
	this.AmountType = &amountType
	var cooldownPeriod = "5m"
	this.CooldownPeriod = &cooldownPeriod
	this.DeleteVolumes = &deleteVolumes

	return &this
}

// NewGroupPolicyScaleInActionWithDefaults instantiates a new GroupPolicyScaleInAction 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 NewGroupPolicyScaleInActionWithDefaults() *GroupPolicyScaleInAction {
	this := GroupPolicyScaleInAction{}
	var cooldownPeriod = "5m"
	this.CooldownPeriod = &cooldownPeriod
	return &this
}

// GetAmount returns the Amount field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *GroupPolicyScaleInAction) GetAmount() *float32 {
	if o == nil {
		return nil
	}

	return o.Amount

}

// GetAmountOk returns a tuple with the Amount 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 *GroupPolicyScaleInAction) GetAmountOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Amount, true
}

// SetAmount sets field value
func (o *GroupPolicyScaleInAction) SetAmount(v float32) {

	o.Amount = &v

}

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

	return false
}

// GetAmountType returns the AmountType field value
// If the value is explicit nil, the zero value for ActionAmount will be returned
func (o *GroupPolicyScaleInAction) GetAmountType() *ActionAmount {
	if o == nil {
		return nil
	}

	return o.AmountType

}

// GetAmountTypeOk returns a tuple with the AmountType 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 *GroupPolicyScaleInAction) GetAmountTypeOk() (*ActionAmount, bool) {
	if o == nil {
		return nil, false
	}

	return o.AmountType, true
}

// SetAmountType sets field value
func (o *GroupPolicyScaleInAction) SetAmountType(v ActionAmount) {

	o.AmountType = &v

}

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

	return false
}

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

	return o.CooldownPeriod

}

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

	return o.CooldownPeriod, true
}

// SetCooldownPeriod sets field value
func (o *GroupPolicyScaleInAction) SetCooldownPeriod(v string) {

	o.CooldownPeriod = &v

}

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

	return false
}

// GetTerminationPolicy returns the TerminationPolicy field value
// If the value is explicit nil, the zero value for TerminationPolicyType will be returned
func (o *GroupPolicyScaleInAction) GetTerminationPolicy() *TerminationPolicyType {
	if o == nil {
		return nil
	}

	return o.TerminationPolicy

}

// GetTerminationPolicyOk returns a tuple with the TerminationPolicy 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 *GroupPolicyScaleInAction) GetTerminationPolicyOk() (*TerminationPolicyType, bool) {
	if o == nil {
		return nil, false
	}

	return o.TerminationPolicy, true
}

// SetTerminationPolicy sets field value
func (o *GroupPolicyScaleInAction) SetTerminationPolicy(v TerminationPolicyType) {

	o.TerminationPolicy = &v

}

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

	return false
}

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

	return o.DeleteVolumes

}

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

	return o.DeleteVolumes, true
}

// SetDeleteVolumes sets field value
func (o *GroupPolicyScaleInAction) SetDeleteVolumes(v bool) {

	o.DeleteVolumes = &v

}

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

	return false
}

func (o GroupPolicyScaleInAction) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Amount != nil {
		toSerialize["amount"] = o.Amount
	}

	if o.AmountType != nil {
		toSerialize["amountType"] = o.AmountType
	}

	toSerialize["cooldownPeriod"] = o.CooldownPeriod

	toSerialize["terminationPolicy"] = o.TerminationPolicy

	if o.DeleteVolumes != nil {
		toSerialize["deleteVolumes"] = o.DeleteVolumes
	}

	return json.Marshal(toSerialize)
}

type NullableGroupPolicyScaleInAction struct {
	value *GroupPolicyScaleInAction
	isSet bool
}

func (v NullableGroupPolicyScaleInAction) Get() *GroupPolicyScaleInAction {
	return v.value
}

func (v *NullableGroupPolicyScaleInAction) Set(val *GroupPolicyScaleInAction) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableGroupPolicyScaleInAction(val *GroupPolicyScaleInAction) *NullableGroupPolicyScaleInAction {
	return &NullableGroupPolicyScaleInAction{value: val, isSet: true}
}

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

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