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

// PtyResizeRequest struct for PtyResizeRequest
type PtyResizeRequest struct {
	// Number of terminal columns
	Cols float32 `json:"cols"`
	// Number of terminal rows
	Rows float32 `json:"rows"`
	AdditionalProperties map[string]interface{}
}

type _PtyResizeRequest PtyResizeRequest

// NewPtyResizeRequest instantiates a new PtyResizeRequest 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 NewPtyResizeRequest(cols float32, rows float32) *PtyResizeRequest {
	this := PtyResizeRequest{}
	this.Cols = cols
	this.Rows = rows
	return &this
}

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

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

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

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

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

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

func (o PtyResizeRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["cols"] = o.Cols
	toSerialize["rows"] = o.Rows

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

	return toSerialize, nil
}

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

	varPtyResizeRequest := _PtyResizeRequest{}

	err = json.Unmarshal(data, &varPtyResizeRequest)

	if err != nil {
		return err
	}

	*o = PtyResizeRequest(varPtyResizeRequest)

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

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

	return err
}

type NullablePtyResizeRequest struct {
	value *PtyResizeRequest
	isSet bool
}

func (v NullablePtyResizeRequest) Get() *PtyResizeRequest {
	return v.value
}

func (v *NullablePtyResizeRequest) Set(val *PtyResizeRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePtyResizeRequest(val *PtyResizeRequest) *NullablePtyResizeRequest {
	return &NullablePtyResizeRequest{value: val, isSet: true}
}

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

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


