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

// Region struct for Region
type Region struct {
	// Region ID
	Id string `json:"id"`
	// Region name
	Name string `json:"name"`
	// Organization ID
	OrganizationId NullableString `json:"organizationId,omitempty"`
	// The type of the region
	RegionType RegionType `json:"regionType"`
	// Creation timestamp
	CreatedAt string `json:"createdAt"`
	// Last update timestamp
	UpdatedAt string `json:"updatedAt"`
	// 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 _Region Region

// NewRegion instantiates a new Region 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 NewRegion(id string, name string, regionType RegionType, createdAt string, updatedAt string) *Region {
	this := Region{}
	this.Id = id
	this.Name = name
	this.RegionType = regionType
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	return &this
}

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

// GetId returns the Id field value
func (o *Region) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *Region) SetId(v string) {
	o.Id = v
}

// GetName returns the Name field value
func (o *Region) 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 *Region) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Name, true
}

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

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

// GetOrganizationIdOk returns a tuple with the OrganizationId 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 *Region) GetOrganizationIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.OrganizationId.Get(), o.OrganizationId.IsSet()
}

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

	return false
}

// SetOrganizationId gets a reference to the given NullableString and assigns it to the OrganizationId field.
func (o *Region) SetOrganizationId(v string) {
	o.OrganizationId.Set(&v)
}
// SetOrganizationIdNil sets the value for OrganizationId to be an explicit nil
func (o *Region) SetOrganizationIdNil() {
	o.OrganizationId.Set(nil)
}

// UnsetOrganizationId ensures that no value is present for OrganizationId, not even an explicit nil
func (o *Region) UnsetOrganizationId() {
	o.OrganizationId.Unset()
}

// GetRegionType returns the RegionType field value
func (o *Region) GetRegionType() RegionType {
	if o == nil {
		var ret RegionType
		return ret
	}

	return o.RegionType
}

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

// SetRegionType sets field value
func (o *Region) SetRegionType(v RegionType) {
	o.RegionType = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *Region) GetCreatedAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.CreatedAt
}

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

// SetCreatedAt sets field value
func (o *Region) SetCreatedAt(v string) {
	o.CreatedAt = v
}

// GetUpdatedAt returns the UpdatedAt field value
func (o *Region) GetUpdatedAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.UpdatedAt
}

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

// SetUpdatedAt sets field value
func (o *Region) SetUpdatedAt(v string) {
	o.UpdatedAt = v
}

// GetProxyUrl returns the ProxyUrl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Region) 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 *Region) 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 *Region) 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 *Region) SetProxyUrl(v string) {
	o.ProxyUrl.Set(&v)
}
// SetProxyUrlNil sets the value for ProxyUrl to be an explicit nil
func (o *Region) SetProxyUrlNil() {
	o.ProxyUrl.Set(nil)
}

// UnsetProxyUrl ensures that no value is present for ProxyUrl, not even an explicit nil
func (o *Region) 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 *Region) 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 *Region) 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 *Region) 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 *Region) SetSshGatewayUrl(v string) {
	o.SshGatewayUrl.Set(&v)
}
// SetSshGatewayUrlNil sets the value for SshGatewayUrl to be an explicit nil
func (o *Region) SetSshGatewayUrlNil() {
	o.SshGatewayUrl.Set(nil)
}

// UnsetSshGatewayUrl ensures that no value is present for SshGatewayUrl, not even an explicit nil
func (o *Region) 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 *Region) 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 *Region) 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 *Region) 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 *Region) SetSnapshotManagerUrl(v string) {
	o.SnapshotManagerUrl.Set(&v)
}
// SetSnapshotManagerUrlNil sets the value for SnapshotManagerUrl to be an explicit nil
func (o *Region) SetSnapshotManagerUrlNil() {
	o.SnapshotManagerUrl.Set(nil)
}

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

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

func (o Region) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["name"] = o.Name
	if o.OrganizationId.IsSet() {
		toSerialize["organizationId"] = o.OrganizationId.Get()
	}
	toSerialize["regionType"] = o.RegionType
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt
	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 *Region) 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{
		"id",
		"name",
		"regionType",
		"createdAt",
		"updatedAt",
	}

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

	varRegion := _Region{}

	err = json.Unmarshal(data, &varRegion)

	if err != nil {
		return err
	}

	*o = Region(varRegion)

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

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

	return err
}

type NullableRegion struct {
	value *Region
	isSet bool
}

func (v NullableRegion) Get() *Region {
	return v.value
}

func (v *NullableRegion) Set(val *Region) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRegion(val *Region) *NullableRegion {
	return &NullableRegion{value: val, isSet: true}
}

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

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


