/*
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"
)

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

// PortList struct for PortList
type PortList struct {
	Ports []int32 `json:"ports,omitempty"`
}

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

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

// GetPorts returns the Ports field value if set, zero value otherwise.
func (o *PortList) GetPorts() []int32 {
	if o == nil || IsNil(o.Ports) {
		var ret []int32
		return ret
	}
	return o.Ports
}

// GetPortsOk returns a tuple with the Ports field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PortList) GetPortsOk() ([]int32, bool) {
	if o == nil || IsNil(o.Ports) {
		return nil, false
	}
	return o.Ports, true
}

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

	return false
}

// SetPorts gets a reference to the given []int32 and assigns it to the Ports field.
func (o *PortList) SetPorts(v []int32) {
	o.Ports = v
}

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

func (o PortList) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Ports) {
		toSerialize["ports"] = o.Ports
	}
	return toSerialize, nil
}

type NullablePortList struct {
	value *PortList
	isSet bool
}

func (v NullablePortList) Get() *PortList {
	return v.value
}

func (v *NullablePortList) Set(val *PortList) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePortList(val *PortList) *NullablePortList {
	return &NullablePortList{value: val, isSet: true}
}

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

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


