/*
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 RateLimitConfig type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RateLimitConfig{}

// RateLimitConfig struct for RateLimitConfig
type RateLimitConfig struct {
	// Failed authentication rate limit
	FailedAuth *RateLimitEntry `json:"failedAuth,omitempty"`
	// Authenticated rate limit
	Authenticated *RateLimitEntry `json:"authenticated,omitempty"`
	// Sandbox create rate limit
	SandboxCreate *RateLimitEntry `json:"sandboxCreate,omitempty"`
	// Sandbox lifecycle rate limit
	SandboxLifecycle *RateLimitEntry `json:"sandboxLifecycle,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _RateLimitConfig RateLimitConfig

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

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

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

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

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

	return false
}

// SetFailedAuth gets a reference to the given RateLimitEntry and assigns it to the FailedAuth field.
func (o *RateLimitConfig) SetFailedAuth(v RateLimitEntry) {
	o.FailedAuth = &v
}

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

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

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

	return false
}

// SetAuthenticated gets a reference to the given RateLimitEntry and assigns it to the Authenticated field.
func (o *RateLimitConfig) SetAuthenticated(v RateLimitEntry) {
	o.Authenticated = &v
}

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

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

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

	return false
}

// SetSandboxCreate gets a reference to the given RateLimitEntry and assigns it to the SandboxCreate field.
func (o *RateLimitConfig) SetSandboxCreate(v RateLimitEntry) {
	o.SandboxCreate = &v
}

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

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

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

	return false
}

// SetSandboxLifecycle gets a reference to the given RateLimitEntry and assigns it to the SandboxLifecycle field.
func (o *RateLimitConfig) SetSandboxLifecycle(v RateLimitEntry) {
	o.SandboxLifecycle = &v
}

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

func (o RateLimitConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.FailedAuth) {
		toSerialize["failedAuth"] = o.FailedAuth
	}
	if !IsNil(o.Authenticated) {
		toSerialize["authenticated"] = o.Authenticated
	}
	if !IsNil(o.SandboxCreate) {
		toSerialize["sandboxCreate"] = o.SandboxCreate
	}
	if !IsNil(o.SandboxLifecycle) {
		toSerialize["sandboxLifecycle"] = o.SandboxLifecycle
	}

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

	return toSerialize, nil
}

func (o *RateLimitConfig) UnmarshalJSON(data []byte) (err error) {
	varRateLimitConfig := _RateLimitConfig{}

	err = json.Unmarshal(data, &varRateLimitConfig)

	if err != nil {
		return err
	}

	*o = RateLimitConfig(varRateLimitConfig)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "failedAuth")
		delete(additionalProperties, "authenticated")
		delete(additionalProperties, "sandboxCreate")
		delete(additionalProperties, "sandboxLifecycle")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRateLimitConfig struct {
	value *RateLimitConfig
	isSet bool
}

func (v NullableRateLimitConfig) Get() *RateLimitConfig {
	return v.value
}

func (v *NullableRateLimitConfig) Set(val *RateLimitConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRateLimitConfig(val *RateLimitConfig) *NullableRateLimitConfig {
	return &NullableRateLimitConfig{value: val, isSet: true}
}

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

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


