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

// SandboxInfo struct for SandboxInfo
type SandboxInfo struct {
	// The creation timestamp of the project
	Created string `json:"created"`
	// Deprecated: The name of the sandbox
	// Deprecated
	Name string `json:"name"`
	// Additional metadata provided by the provider
	ProviderMetadata *string `json:"providerMetadata,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _SandboxInfo SandboxInfo

// NewSandboxInfo instantiates a new SandboxInfo 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 NewSandboxInfo(created string, name string) *SandboxInfo {
	this := SandboxInfo{}
	this.Created = created
	this.Name = name
	return &this
}

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

// GetCreated returns the Created field value
func (o *SandboxInfo) GetCreated() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Created
}

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

// SetCreated sets field value
func (o *SandboxInfo) SetCreated(v string) {
	o.Created = v
}

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

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

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

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

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

	return false
}

// SetProviderMetadata gets a reference to the given string and assigns it to the ProviderMetadata field.
func (o *SandboxInfo) SetProviderMetadata(v string) {
	o.ProviderMetadata = &v
}

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

func (o SandboxInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["created"] = o.Created
	toSerialize["name"] = o.Name
	if !IsNil(o.ProviderMetadata) {
		toSerialize["providerMetadata"] = o.ProviderMetadata
	}

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

	return toSerialize, nil
}

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

	varSandboxInfo := _SandboxInfo{}

	err = json.Unmarshal(data, &varSandboxInfo)

	if err != nil {
		return err
	}

	*o = SandboxInfo(varSandboxInfo)

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

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

	return err
}

type NullableSandboxInfo struct {
	value *SandboxInfo
	isSet bool
}

func (v NullableSandboxInfo) Get() *SandboxInfo {
	return v.value
}

func (v *NullableSandboxInfo) Set(val *SandboxInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableSandboxInfo(val *SandboxInfo) *NullableSandboxInfo {
	return &NullableSandboxInfo{value: val, isSet: true}
}

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

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


