/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
)

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

// RateLimitEntry struct for RateLimitEntry
type RateLimitEntry struct {
	// Rate limit TTL in seconds
	Ttl *float32 `json:"ttl,omitempty"`
	// Rate limit max requests
	Limit *float32 `json:"limit,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _RateLimitEntry RateLimitEntry

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

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

// GetTtl returns the Ttl field value if set, zero value otherwise.
func (o *RateLimitEntry) GetTtl() float32 {
	if o == nil || IsNil(o.Ttl) {
		var ret float32
		return ret
	}
	return *o.Ttl
}

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

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

	return false
}

// SetTtl gets a reference to the given float32 and assigns it to the Ttl field.
func (o *RateLimitEntry) SetTtl(v float32) {
	o.Ttl = &v
}

// GetLimit returns the Limit field value if set, zero value otherwise.
func (o *RateLimitEntry) GetLimit() float32 {
	if o == nil || IsNil(o.Limit) {
		var ret float32
		return ret
	}
	return *o.Limit
}

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

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

	return false
}

// SetLimit gets a reference to the given float32 and assigns it to the Limit field.
func (o *RateLimitEntry) SetLimit(v float32) {
	o.Limit = &v
}

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

func (o RateLimitEntry) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Ttl) {
		toSerialize["ttl"] = o.Ttl
	}
	if !IsNil(o.Limit) {
		toSerialize["limit"] = o.Limit
	}

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

	return toSerialize, nil
}

func (o *RateLimitEntry) UnmarshalJSON(data []byte) (err error) {
	varRateLimitEntry := _RateLimitEntry{}

	err = json.Unmarshal(data, &varRateLimitEntry)

	if err != nil {
		return err
	}

	*o = RateLimitEntry(varRateLimitEntry)

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

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

	return err
}

type NullableRateLimitEntry struct {
	value *RateLimitEntry
	isSet bool
}

func (v NullableRateLimitEntry) Get() *RateLimitEntry {
	return v.value
}

func (v *NullableRateLimitEntry) Set(val *RateLimitEntry) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRateLimitEntry(val *RateLimitEntry) *NullableRateLimitEntry {
	return &NullableRateLimitEntry{value: val, isSet: true}
}

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

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


