/*
Daytona Toolbox API

Daytona Toolbox API

API version: v0.0.0-dev
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package toolbox

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the PtySessionInfo type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &PtySessionInfo{}

// PtySessionInfo struct for PtySessionInfo
type PtySessionInfo struct {
	Active bool `json:"active"`
	Cols int32 `json:"cols"`
	CreatedAt string `json:"createdAt"`
	Cwd string `json:"cwd"`
	Envs map[string]string `json:"envs"`
	Id string `json:"id"`
	// Whether this session uses lazy start
	LazyStart bool `json:"lazyStart"`
	Rows int32 `json:"rows"`
}

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

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

// GetCols returns the Cols field value
func (o *PtySessionInfo) GetCols() int32 {
	if o == nil {
		var ret int32
		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() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Cols, true
}

// SetCols sets field value
func (o *PtySessionInfo) SetCols(v int32) {
	o.Cols = 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
}

// 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]string {
	if o == nil {
		var ret map[string]string
		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]string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Envs, true
}

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

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

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

// GetRows returns the Rows field value
func (o *PtySessionInfo) GetRows() int32 {
	if o == nil {
		var ret int32
		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() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Rows, true
}

// SetRows sets field value
func (o *PtySessionInfo) SetRows(v int32) {
	o.Rows = 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["active"] = o.Active
	toSerialize["cols"] = o.Cols
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["cwd"] = o.Cwd
	toSerialize["envs"] = o.Envs
	toSerialize["id"] = o.Id
	toSerialize["lazyStart"] = o.LazyStart
	toSerialize["rows"] = o.Rows
	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{
		"active",
		"cols",
		"createdAt",
		"cwd",
		"envs",
		"id",
		"lazyStart",
		"rows",
	}

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

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varPtySessionInfo)

	if err != nil {
		return err
	}

	*o = PtySessionInfo(varPtySessionInfo)

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


