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

// PtyCreateRequest struct for PtyCreateRequest
type PtyCreateRequest struct {
	// The unique identifier for the PTY session
	Id string `json:"id"`
	// Starting directory for the PTY session, defaults to the sandbox's working directory
	Cwd *string `json:"cwd,omitempty"`
	// Environment variables for the PTY session
	Envs map[string]interface{} `json:"envs,omitempty"`
	// Number of terminal columns
	Cols *float32 `json:"cols,omitempty"`
	// Number of terminal rows
	Rows *float32 `json:"rows,omitempty"`
	// Whether to start the PTY session lazily (only start when first client connects)
	LazyStart *bool `json:"lazyStart,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _PtyCreateRequest PtyCreateRequest

// NewPtyCreateRequest instantiates a new PtyCreateRequest 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 NewPtyCreateRequest(id string) *PtyCreateRequest {
	this := PtyCreateRequest{}
	this.Id = id
	var lazyStart bool = false
	this.LazyStart = &lazyStart
	return &this
}

// NewPtyCreateRequestWithDefaults instantiates a new PtyCreateRequest 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 NewPtyCreateRequestWithDefaults() *PtyCreateRequest {
	this := PtyCreateRequest{}
	var lazyStart bool = false
	this.LazyStart = &lazyStart
	return &this
}

// GetId returns the Id field value
func (o *PtyCreateRequest) 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 *PtyCreateRequest) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Id, true
}

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

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

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

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

	return false
}

// SetCwd gets a reference to the given string and assigns it to the Cwd field.
func (o *PtyCreateRequest) SetCwd(v string) {
	o.Cwd = &v
}

// GetEnvs returns the Envs field value if set, zero value otherwise.
func (o *PtyCreateRequest) GetEnvs() map[string]interface{} {
	if o == nil || IsNil(o.Envs) {
		var ret map[string]interface{}
		return ret
	}
	return o.Envs
}

// GetEnvsOk returns a tuple with the Envs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PtyCreateRequest) GetEnvsOk() (map[string]interface{}, bool) {
	if o == nil || IsNil(o.Envs) {
		return map[string]interface{}{}, false
	}
	return o.Envs, true
}

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

	return false
}

// SetEnvs gets a reference to the given map[string]interface{} and assigns it to the Envs field.
func (o *PtyCreateRequest) SetEnvs(v map[string]interface{}) {
	o.Envs = v
}

// GetCols returns the Cols field value if set, zero value otherwise.
func (o *PtyCreateRequest) GetCols() float32 {
	if o == nil || IsNil(o.Cols) {
		var ret float32
		return ret
	}
	return *o.Cols
}

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

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

	return false
}

// SetCols gets a reference to the given float32 and assigns it to the Cols field.
func (o *PtyCreateRequest) SetCols(v float32) {
	o.Cols = &v
}

// GetRows returns the Rows field value if set, zero value otherwise.
func (o *PtyCreateRequest) GetRows() float32 {
	if o == nil || IsNil(o.Rows) {
		var ret float32
		return ret
	}
	return *o.Rows
}

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

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

	return false
}

// SetRows gets a reference to the given float32 and assigns it to the Rows field.
func (o *PtyCreateRequest) SetRows(v float32) {
	o.Rows = &v
}

// GetLazyStart returns the LazyStart field value if set, zero value otherwise.
func (o *PtyCreateRequest) GetLazyStart() bool {
	if o == nil || IsNil(o.LazyStart) {
		var ret bool
		return ret
	}
	return *o.LazyStart
}

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

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

	return false
}

// SetLazyStart gets a reference to the given bool and assigns it to the LazyStart field.
func (o *PtyCreateRequest) SetLazyStart(v bool) {
	o.LazyStart = &v
}

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

func (o PtyCreateRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	if !IsNil(o.Cwd) {
		toSerialize["cwd"] = o.Cwd
	}
	if !IsNil(o.Envs) {
		toSerialize["envs"] = o.Envs
	}
	if !IsNil(o.Cols) {
		toSerialize["cols"] = o.Cols
	}
	if !IsNil(o.Rows) {
		toSerialize["rows"] = o.Rows
	}
	if !IsNil(o.LazyStart) {
		toSerialize["lazyStart"] = o.LazyStart
	}

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

	return toSerialize, nil
}

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

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

	varPtyCreateRequest := _PtyCreateRequest{}

	err = json.Unmarshal(data, &varPtyCreateRequest)

	if err != nil {
		return err
	}

	*o = PtyCreateRequest(varPtyCreateRequest)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "cwd")
		delete(additionalProperties, "envs")
		delete(additionalProperties, "cols")
		delete(additionalProperties, "rows")
		delete(additionalProperties, "lazyStart")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullablePtyCreateRequest struct {
	value *PtyCreateRequest
	isSet bool
}

func (v NullablePtyCreateRequest) Get() *PtyCreateRequest {
	return v.value
}

func (v *NullablePtyCreateRequest) Set(val *PtyCreateRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePtyCreateRequest(val *PtyCreateRequest) *NullablePtyCreateRequest {
	return &NullablePtyCreateRequest{value: val, isSet: true}
}

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

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


