/*
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"
	"fmt"
)

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

// DaytonaConfiguration struct for DaytonaConfiguration
type DaytonaConfiguration struct {
	// Daytona version
	Version string `json:"version"`
	// PostHog configuration
	Posthog *PosthogConfig `json:"posthog,omitempty"`
	// OIDC configuration
	Oidc OidcConfig `json:"oidc"`
	// Whether linked accounts are enabled
	LinkedAccountsEnabled bool `json:"linkedAccountsEnabled"`
	// System announcements
	Announcements map[string]Announcement `json:"announcements"`
	// Pylon application ID
	PylonAppId *string `json:"pylonAppId,omitempty"`
	// Proxy template URL
	ProxyTemplateUrl string `json:"proxyTemplateUrl"`
	// Toolbox template URL
	ProxyToolboxUrl string `json:"proxyToolboxUrl"`
	// Default snapshot for sandboxes
	DefaultSnapshot string `json:"defaultSnapshot"`
	// Dashboard URL
	DashboardUrl string `json:"dashboardUrl"`
	// Maximum auto-archive interval in minutes
	MaxAutoArchiveInterval float32 `json:"maxAutoArchiveInterval"`
	// Whether maintenance mode is enabled
	MaintananceMode bool `json:"maintananceMode"`
	// Current environment
	Environment string `json:"environment"`
	// Billing API URL
	BillingApiUrl *string `json:"billingApiUrl,omitempty"`
	// Analytics API URL
	AnalyticsApiUrl *string `json:"analyticsApiUrl,omitempty"`
	// SSH Gateway command
	SshGatewayCommand *string `json:"sshGatewayCommand,omitempty"`
	// Base64 encoded SSH Gateway public key
	SshGatewayPublicKey *string `json:"sshGatewayPublicKey,omitempty"`
	// Rate limit configuration
	RateLimit *RateLimitConfig `json:"rateLimit,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _DaytonaConfiguration DaytonaConfiguration

// NewDaytonaConfiguration instantiates a new DaytonaConfiguration 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 NewDaytonaConfiguration(version string, oidc OidcConfig, linkedAccountsEnabled bool, announcements map[string]Announcement, proxyTemplateUrl string, proxyToolboxUrl string, defaultSnapshot string, dashboardUrl string, maxAutoArchiveInterval float32, maintananceMode bool, environment string) *DaytonaConfiguration {
	this := DaytonaConfiguration{}
	this.Version = version
	this.Oidc = oidc
	this.LinkedAccountsEnabled = linkedAccountsEnabled
	this.Announcements = announcements
	this.ProxyTemplateUrl = proxyTemplateUrl
	this.ProxyToolboxUrl = proxyToolboxUrl
	this.DefaultSnapshot = defaultSnapshot
	this.DashboardUrl = dashboardUrl
	this.MaxAutoArchiveInterval = maxAutoArchiveInterval
	this.MaintananceMode = maintananceMode
	this.Environment = environment
	return &this
}

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

// GetVersion returns the Version field value
func (o *DaytonaConfiguration) GetVersion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Version
}

// GetVersionOk returns a tuple with the Version field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetVersionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Version, true
}

// SetVersion sets field value
func (o *DaytonaConfiguration) SetVersion(v string) {
	o.Version = v
}

// GetPosthog returns the Posthog field value if set, zero value otherwise.
func (o *DaytonaConfiguration) GetPosthog() PosthogConfig {
	if o == nil || IsNil(o.Posthog) {
		var ret PosthogConfig
		return ret
	}
	return *o.Posthog
}

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

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

	return false
}

// SetPosthog gets a reference to the given PosthogConfig and assigns it to the Posthog field.
func (o *DaytonaConfiguration) SetPosthog(v PosthogConfig) {
	o.Posthog = &v
}

// GetOidc returns the Oidc field value
func (o *DaytonaConfiguration) GetOidc() OidcConfig {
	if o == nil {
		var ret OidcConfig
		return ret
	}

	return o.Oidc
}

// GetOidcOk returns a tuple with the Oidc field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetOidcOk() (*OidcConfig, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Oidc, true
}

// SetOidc sets field value
func (o *DaytonaConfiguration) SetOidc(v OidcConfig) {
	o.Oidc = v
}

// GetLinkedAccountsEnabled returns the LinkedAccountsEnabled field value
func (o *DaytonaConfiguration) GetLinkedAccountsEnabled() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.LinkedAccountsEnabled
}

// GetLinkedAccountsEnabledOk returns a tuple with the LinkedAccountsEnabled field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetLinkedAccountsEnabledOk() (*bool, bool) {
	if o == nil {
		return nil, false
	}
	return &o.LinkedAccountsEnabled, true
}

// SetLinkedAccountsEnabled sets field value
func (o *DaytonaConfiguration) SetLinkedAccountsEnabled(v bool) {
	o.LinkedAccountsEnabled = v
}

// GetAnnouncements returns the Announcements field value
func (o *DaytonaConfiguration) GetAnnouncements() map[string]Announcement {
	if o == nil {
		var ret map[string]Announcement
		return ret
	}

	return o.Announcements
}

// GetAnnouncementsOk returns a tuple with the Announcements field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetAnnouncementsOk() (*map[string]Announcement, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Announcements, true
}

// SetAnnouncements sets field value
func (o *DaytonaConfiguration) SetAnnouncements(v map[string]Announcement) {
	o.Announcements = v
}

// GetPylonAppId returns the PylonAppId field value if set, zero value otherwise.
func (o *DaytonaConfiguration) GetPylonAppId() string {
	if o == nil || IsNil(o.PylonAppId) {
		var ret string
		return ret
	}
	return *o.PylonAppId
}

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

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

	return false
}

// SetPylonAppId gets a reference to the given string and assigns it to the PylonAppId field.
func (o *DaytonaConfiguration) SetPylonAppId(v string) {
	o.PylonAppId = &v
}

// GetProxyTemplateUrl returns the ProxyTemplateUrl field value
func (o *DaytonaConfiguration) GetProxyTemplateUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ProxyTemplateUrl
}

// GetProxyTemplateUrlOk returns a tuple with the ProxyTemplateUrl field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetProxyTemplateUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ProxyTemplateUrl, true
}

// SetProxyTemplateUrl sets field value
func (o *DaytonaConfiguration) SetProxyTemplateUrl(v string) {
	o.ProxyTemplateUrl = v
}

// GetProxyToolboxUrl returns the ProxyToolboxUrl field value
func (o *DaytonaConfiguration) GetProxyToolboxUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ProxyToolboxUrl
}

// GetProxyToolboxUrlOk returns a tuple with the ProxyToolboxUrl field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetProxyToolboxUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ProxyToolboxUrl, true
}

// SetProxyToolboxUrl sets field value
func (o *DaytonaConfiguration) SetProxyToolboxUrl(v string) {
	o.ProxyToolboxUrl = v
}

// GetDefaultSnapshot returns the DefaultSnapshot field value
func (o *DaytonaConfiguration) GetDefaultSnapshot() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DefaultSnapshot
}

// GetDefaultSnapshotOk returns a tuple with the DefaultSnapshot field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetDefaultSnapshotOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.DefaultSnapshot, true
}

// SetDefaultSnapshot sets field value
func (o *DaytonaConfiguration) SetDefaultSnapshot(v string) {
	o.DefaultSnapshot = v
}

// GetDashboardUrl returns the DashboardUrl field value
func (o *DaytonaConfiguration) GetDashboardUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DashboardUrl
}

// GetDashboardUrlOk returns a tuple with the DashboardUrl field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetDashboardUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.DashboardUrl, true
}

// SetDashboardUrl sets field value
func (o *DaytonaConfiguration) SetDashboardUrl(v string) {
	o.DashboardUrl = v
}

// GetMaxAutoArchiveInterval returns the MaxAutoArchiveInterval field value
func (o *DaytonaConfiguration) GetMaxAutoArchiveInterval() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.MaxAutoArchiveInterval
}

// GetMaxAutoArchiveIntervalOk returns a tuple with the MaxAutoArchiveInterval field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetMaxAutoArchiveIntervalOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.MaxAutoArchiveInterval, true
}

// SetMaxAutoArchiveInterval sets field value
func (o *DaytonaConfiguration) SetMaxAutoArchiveInterval(v float32) {
	o.MaxAutoArchiveInterval = v
}

// GetMaintananceMode returns the MaintananceMode field value
func (o *DaytonaConfiguration) GetMaintananceMode() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.MaintananceMode
}

// GetMaintananceModeOk returns a tuple with the MaintananceMode field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetMaintananceModeOk() (*bool, bool) {
	if o == nil {
		return nil, false
	}
	return &o.MaintananceMode, true
}

// SetMaintananceMode sets field value
func (o *DaytonaConfiguration) SetMaintananceMode(v bool) {
	o.MaintananceMode = v
}

// GetEnvironment returns the Environment field value
func (o *DaytonaConfiguration) GetEnvironment() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Environment
}

// GetEnvironmentOk returns a tuple with the Environment field value
// and a boolean to check if the value has been set.
func (o *DaytonaConfiguration) GetEnvironmentOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Environment, true
}

// SetEnvironment sets field value
func (o *DaytonaConfiguration) SetEnvironment(v string) {
	o.Environment = v
}

// GetBillingApiUrl returns the BillingApiUrl field value if set, zero value otherwise.
func (o *DaytonaConfiguration) GetBillingApiUrl() string {
	if o == nil || IsNil(o.BillingApiUrl) {
		var ret string
		return ret
	}
	return *o.BillingApiUrl
}

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

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

	return false
}

// SetBillingApiUrl gets a reference to the given string and assigns it to the BillingApiUrl field.
func (o *DaytonaConfiguration) SetBillingApiUrl(v string) {
	o.BillingApiUrl = &v
}

// GetAnalyticsApiUrl returns the AnalyticsApiUrl field value if set, zero value otherwise.
func (o *DaytonaConfiguration) GetAnalyticsApiUrl() string {
	if o == nil || IsNil(o.AnalyticsApiUrl) {
		var ret string
		return ret
	}
	return *o.AnalyticsApiUrl
}

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

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

	return false
}

// SetAnalyticsApiUrl gets a reference to the given string and assigns it to the AnalyticsApiUrl field.
func (o *DaytonaConfiguration) SetAnalyticsApiUrl(v string) {
	o.AnalyticsApiUrl = &v
}

// GetSshGatewayCommand returns the SshGatewayCommand field value if set, zero value otherwise.
func (o *DaytonaConfiguration) GetSshGatewayCommand() string {
	if o == nil || IsNil(o.SshGatewayCommand) {
		var ret string
		return ret
	}
	return *o.SshGatewayCommand
}

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

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

	return false
}

// SetSshGatewayCommand gets a reference to the given string and assigns it to the SshGatewayCommand field.
func (o *DaytonaConfiguration) SetSshGatewayCommand(v string) {
	o.SshGatewayCommand = &v
}

// GetSshGatewayPublicKey returns the SshGatewayPublicKey field value if set, zero value otherwise.
func (o *DaytonaConfiguration) GetSshGatewayPublicKey() string {
	if o == nil || IsNil(o.SshGatewayPublicKey) {
		var ret string
		return ret
	}
	return *o.SshGatewayPublicKey
}

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

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

	return false
}

// SetSshGatewayPublicKey gets a reference to the given string and assigns it to the SshGatewayPublicKey field.
func (o *DaytonaConfiguration) SetSshGatewayPublicKey(v string) {
	o.SshGatewayPublicKey = &v
}

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

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

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

	return false
}

// SetRateLimit gets a reference to the given RateLimitConfig and assigns it to the RateLimit field.
func (o *DaytonaConfiguration) SetRateLimit(v RateLimitConfig) {
	o.RateLimit = &v
}

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

func (o DaytonaConfiguration) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["version"] = o.Version
	if !IsNil(o.Posthog) {
		toSerialize["posthog"] = o.Posthog
	}
	toSerialize["oidc"] = o.Oidc
	toSerialize["linkedAccountsEnabled"] = o.LinkedAccountsEnabled
	toSerialize["announcements"] = o.Announcements
	if !IsNil(o.PylonAppId) {
		toSerialize["pylonAppId"] = o.PylonAppId
	}
	toSerialize["proxyTemplateUrl"] = o.ProxyTemplateUrl
	toSerialize["proxyToolboxUrl"] = o.ProxyToolboxUrl
	toSerialize["defaultSnapshot"] = o.DefaultSnapshot
	toSerialize["dashboardUrl"] = o.DashboardUrl
	toSerialize["maxAutoArchiveInterval"] = o.MaxAutoArchiveInterval
	toSerialize["maintananceMode"] = o.MaintananceMode
	toSerialize["environment"] = o.Environment
	if !IsNil(o.BillingApiUrl) {
		toSerialize["billingApiUrl"] = o.BillingApiUrl
	}
	if !IsNil(o.AnalyticsApiUrl) {
		toSerialize["analyticsApiUrl"] = o.AnalyticsApiUrl
	}
	if !IsNil(o.SshGatewayCommand) {
		toSerialize["sshGatewayCommand"] = o.SshGatewayCommand
	}
	if !IsNil(o.SshGatewayPublicKey) {
		toSerialize["sshGatewayPublicKey"] = o.SshGatewayPublicKey
	}
	if !IsNil(o.RateLimit) {
		toSerialize["rateLimit"] = o.RateLimit
	}

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

	return toSerialize, nil
}

func (o *DaytonaConfiguration) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"version",
		"oidc",
		"linkedAccountsEnabled",
		"announcements",
		"proxyTemplateUrl",
		"proxyToolboxUrl",
		"defaultSnapshot",
		"dashboardUrl",
		"maxAutoArchiveInterval",
		"maintananceMode",
		"environment",
	}

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

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varDaytonaConfiguration := _DaytonaConfiguration{}

	err = json.Unmarshal(data, &varDaytonaConfiguration)

	if err != nil {
		return err
	}

	*o = DaytonaConfiguration(varDaytonaConfiguration)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "version")
		delete(additionalProperties, "posthog")
		delete(additionalProperties, "oidc")
		delete(additionalProperties, "linkedAccountsEnabled")
		delete(additionalProperties, "announcements")
		delete(additionalProperties, "pylonAppId")
		delete(additionalProperties, "proxyTemplateUrl")
		delete(additionalProperties, "proxyToolboxUrl")
		delete(additionalProperties, "defaultSnapshot")
		delete(additionalProperties, "dashboardUrl")
		delete(additionalProperties, "maxAutoArchiveInterval")
		delete(additionalProperties, "maintananceMode")
		delete(additionalProperties, "environment")
		delete(additionalProperties, "billingApiUrl")
		delete(additionalProperties, "analyticsApiUrl")
		delete(additionalProperties, "sshGatewayCommand")
		delete(additionalProperties, "sshGatewayPublicKey")
		delete(additionalProperties, "rateLimit")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableDaytonaConfiguration struct {
	value *DaytonaConfiguration
	isSet bool
}

func (v NullableDaytonaConfiguration) Get() *DaytonaConfiguration {
	return v.value
}

func (v *NullableDaytonaConfiguration) Set(val *DaytonaConfiguration) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDaytonaConfiguration(val *DaytonaConfiguration) *NullableDaytonaConfiguration {
	return &NullableDaytonaConfiguration{value: val, isSet: true}
}

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

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


