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

// CreateRegion struct for CreateRegion
type CreateRegion struct {
	// Region name
	Name string `json:"name"`
	// Proxy URL for the region
	ProxyUrl NullableString `json:"proxyUrl,omitempty"`
	// SSH Gateway URL for the region
	SshGatewayUrl NullableString `json:"sshGatewayUrl,omitempty"`
	// Snapshot Manager URL for the region
	SnapshotManagerUrl NullableString `json:"snapshotManagerUrl,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _CreateRegion CreateRegion

// NewCreateRegion instantiates a new CreateRegion 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 NewCreateRegion(name string) *CreateRegion {
	this := CreateRegion{}
	this.Name = name
	return &this
}

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

// GetName returns the Name field value
func (o *CreateRegion) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *CreateRegion) SetName(v string) {
	o.Name = v
}

// GetProxyUrl returns the ProxyUrl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *CreateRegion) GetProxyUrl() string {
	if o == nil || IsNil(o.ProxyUrl.Get()) {
		var ret string
		return ret
	}
	return *o.ProxyUrl.Get()
}

// GetProxyUrlOk returns a tuple with the ProxyUrl field value if set, nil otherwise
// 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 *CreateRegion) GetProxyUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.ProxyUrl.Get(), o.ProxyUrl.IsSet()
}

// HasProxyUrl returns a boolean if a field has been set.
func (o *CreateRegion) HasProxyUrl() bool {
	if o != nil && o.ProxyUrl.IsSet() {
		return true
	}

	return false
}

// SetProxyUrl gets a reference to the given NullableString and assigns it to the ProxyUrl field.
func (o *CreateRegion) SetProxyUrl(v string) {
	o.ProxyUrl.Set(&v)
}
// SetProxyUrlNil sets the value for ProxyUrl to be an explicit nil
func (o *CreateRegion) SetProxyUrlNil() {
	o.ProxyUrl.Set(nil)
}

// UnsetProxyUrl ensures that no value is present for ProxyUrl, not even an explicit nil
func (o *CreateRegion) UnsetProxyUrl() {
	o.ProxyUrl.Unset()
}

// GetSshGatewayUrl returns the SshGatewayUrl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *CreateRegion) GetSshGatewayUrl() string {
	if o == nil || IsNil(o.SshGatewayUrl.Get()) {
		var ret string
		return ret
	}
	return *o.SshGatewayUrl.Get()
}

// GetSshGatewayUrlOk returns a tuple with the SshGatewayUrl field value if set, nil otherwise
// 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 *CreateRegion) GetSshGatewayUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.SshGatewayUrl.Get(), o.SshGatewayUrl.IsSet()
}

// HasSshGatewayUrl returns a boolean if a field has been set.
func (o *CreateRegion) HasSshGatewayUrl() bool {
	if o != nil && o.SshGatewayUrl.IsSet() {
		return true
	}

	return false
}

// SetSshGatewayUrl gets a reference to the given NullableString and assigns it to the SshGatewayUrl field.
func (o *CreateRegion) SetSshGatewayUrl(v string) {
	o.SshGatewayUrl.Set(&v)
}
// SetSshGatewayUrlNil sets the value for SshGatewayUrl to be an explicit nil
func (o *CreateRegion) SetSshGatewayUrlNil() {
	o.SshGatewayUrl.Set(nil)
}

// UnsetSshGatewayUrl ensures that no value is present for SshGatewayUrl, not even an explicit nil
func (o *CreateRegion) UnsetSshGatewayUrl() {
	o.SshGatewayUrl.Unset()
}

// GetSnapshotManagerUrl returns the SnapshotManagerUrl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *CreateRegion) GetSnapshotManagerUrl() string {
	if o == nil || IsNil(o.SnapshotManagerUrl.Get()) {
		var ret string
		return ret
	}
	return *o.SnapshotManagerUrl.Get()
}

// GetSnapshotManagerUrlOk returns a tuple with the SnapshotManagerUrl field value if set, nil otherwise
// 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 *CreateRegion) GetSnapshotManagerUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.SnapshotManagerUrl.Get(), o.SnapshotManagerUrl.IsSet()
}

// HasSnapshotManagerUrl returns a boolean if a field has been set.
func (o *CreateRegion) HasSnapshotManagerUrl() bool {
	if o != nil && o.SnapshotManagerUrl.IsSet() {
		return true
	}

	return false
}

// SetSnapshotManagerUrl gets a reference to the given NullableString and assigns it to the SnapshotManagerUrl field.
func (o *CreateRegion) SetSnapshotManagerUrl(v string) {
	o.SnapshotManagerUrl.Set(&v)
}
// SetSnapshotManagerUrlNil sets the value for SnapshotManagerUrl to be an explicit nil
func (o *CreateRegion) SetSnapshotManagerUrlNil() {
	o.SnapshotManagerUrl.Set(nil)
}

// UnsetSnapshotManagerUrl ensures that no value is present for SnapshotManagerUrl, not even an explicit nil
func (o *CreateRegion) UnsetSnapshotManagerUrl() {
	o.SnapshotManagerUrl.Unset()
}

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

func (o CreateRegion) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["name"] = o.Name
	if o.ProxyUrl.IsSet() {
		toSerialize["proxyUrl"] = o.ProxyUrl.Get()
	}
	if o.SshGatewayUrl.IsSet() {
		toSerialize["sshGatewayUrl"] = o.SshGatewayUrl.Get()
	}
	if o.SnapshotManagerUrl.IsSet() {
		toSerialize["snapshotManagerUrl"] = o.SnapshotManagerUrl.Get()
	}

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

	return toSerialize, nil
}

func (o *CreateRegion) 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{
		"name",
	}

	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)
		}
	}

	varCreateRegion := _CreateRegion{}

	err = json.Unmarshal(data, &varCreateRegion)

	if err != nil {
		return err
	}

	*o = CreateRegion(varCreateRegion)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "name")
		delete(additionalProperties, "proxyUrl")
		delete(additionalProperties, "sshGatewayUrl")
		delete(additionalProperties, "snapshotManagerUrl")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableCreateRegion struct {
	value *CreateRegion
	isSet bool
}

func (v NullableCreateRegion) Get() *CreateRegion {
	return v.value
}

func (v *NullableCreateRegion) Set(val *CreateRegion) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCreateRegion(val *CreateRegion) *NullableCreateRegion {
	return &NullableCreateRegion{value: val, isSet: true}
}

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

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


