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

// PtySessionInfo struct for PtySessionInfo
type PtySessionInfo 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"`
	// Environment variables for the PTY session
	Envs map[string]interface{} `json:"envs"`
	// Number of terminal columns
	Cols float32 `json:"cols"`
	// Number of terminal rows
	Rows float32 `json:"rows"`
	// When the PTY session was created
	CreatedAt string `json:"createdAt"`
	// Whether the PTY session is currently active
	Active bool `json:"active"`
	// Whether the PTY session uses lazy start (only start when first client connects)
	LazyStart bool `json:"lazyStart"`
	AdditionalProperties map[string]interface{}
}

type _PtySessionInfo PtySessionInfo

// NewPtySessionInfo instantiates a new PtySessionInfo 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 NewPtySessionInfo(id string, cwd string, envs map[string]interface{}, cols float32, rows float32, createdAt string, active bool, lazyStart bool) *PtySessionInfo {
	this := PtySessionInfo{}
	this.Id = id
	this.Cwd = cwd
	this.Envs = envs
	this.Cols = cols
	this.Rows = rows
	this.CreatedAt = createdAt
	this.Active = active
	this.LazyStart = lazyStart
	return &this
}

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

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

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

// GetCwd returns the Cwd field value
func (o *PtySessionInfo) GetCwd() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Cwd
}

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

// SetCwd sets field value
func (o *PtySessionInfo) SetCwd(v string) {
	o.Cwd = v
}

// GetEnvs returns the Envs field value
func (o *PtySessionInfo) GetEnvs() map[string]interface{} {
	if o == nil {
		var ret map[string]interface{}
		return ret
	}

	return o.Envs
}

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

// SetEnvs sets field value
func (o *PtySessionInfo) SetEnvs(v map[string]interface{}) {
	o.Envs = v
}

// GetCols returns the Cols field value
func (o *PtySessionInfo) GetCols() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Cols
}

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

// SetCols sets field value
func (o *PtySessionInfo) SetCols(v float32) {
	o.Cols = v
}

// GetRows returns the Rows field value
func (o *PtySessionInfo) GetRows() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Rows
}

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

// SetRows sets field value
func (o *PtySessionInfo) SetRows(v float32) {
	o.Rows = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *PtySessionInfo) 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 *PtySessionInfo) GetCreatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.CreatedAt, true
}

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

// GetActive returns the Active field value
func (o *PtySessionInfo) GetActive() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.Active
}

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

// SetActive sets field value
func (o *PtySessionInfo) SetActive(v bool) {
	o.Active = v
}

// GetLazyStart returns the LazyStart field value
func (o *PtySessionInfo) GetLazyStart() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.LazyStart
}

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

// SetLazyStart sets field value
func (o *PtySessionInfo) SetLazyStart(v bool) {
	o.LazyStart = v
}

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

func (o PtySessionInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["cwd"] = o.Cwd
	toSerialize["envs"] = o.Envs
	toSerialize["cols"] = o.Cols
	toSerialize["rows"] = o.Rows
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["active"] = o.Active
	toSerialize["lazyStart"] = o.LazyStart

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

	return toSerialize, nil
}

func (o *PtySessionInfo) 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",
		"cwd",
		"envs",
		"cols",
		"rows",
		"createdAt",
		"active",
		"lazyStart",
	}

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

	varPtySessionInfo := _PtySessionInfo{}

	err = json.Unmarshal(data, &varPtySessionInfo)

	if err != nil {
		return err
	}

	*o = PtySessionInfo(varPtySessionInfo)

	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, "createdAt")
		delete(additionalProperties, "active")
		delete(additionalProperties, "lazyStart")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullablePtySessionInfo struct {
	value *PtySessionInfo
	isSet bool
}

func (v NullablePtySessionInfo) Get() *PtySessionInfo {
	return v.value
}

func (v *NullablePtySessionInfo) Set(val *PtySessionInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePtySessionInfo(val *PtySessionInfo) *NullablePtySessionInfo {
	return &NullablePtySessionInfo{value: val, isSet: true}
}

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

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


