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

// PaginatedSandboxes struct for PaginatedSandboxes
type PaginatedSandboxes struct {
	Items []Sandbox `json:"items"`
	Total float32 `json:"total"`
	Page float32 `json:"page"`
	TotalPages float32 `json:"totalPages"`
	AdditionalProperties map[string]interface{}
}

type _PaginatedSandboxes PaginatedSandboxes

// NewPaginatedSandboxes instantiates a new PaginatedSandboxes 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 NewPaginatedSandboxes(items []Sandbox, total float32, page float32, totalPages float32) *PaginatedSandboxes {
	this := PaginatedSandboxes{}
	this.Items = items
	this.Total = total
	this.Page = page
	this.TotalPages = totalPages
	return &this
}

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

// GetItems returns the Items field value
func (o *PaginatedSandboxes) GetItems() []Sandbox {
	if o == nil {
		var ret []Sandbox
		return ret
	}

	return o.Items
}

// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *PaginatedSandboxes) GetItemsOk() ([]Sandbox, bool) {
	if o == nil {
		return nil, false
	}
	return o.Items, true
}

// SetItems sets field value
func (o *PaginatedSandboxes) SetItems(v []Sandbox) {
	o.Items = v
}

// GetTotal returns the Total field value
func (o *PaginatedSandboxes) GetTotal() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Total
}

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

// SetTotal sets field value
func (o *PaginatedSandboxes) SetTotal(v float32) {
	o.Total = v
}

// GetPage returns the Page field value
func (o *PaginatedSandboxes) GetPage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Page
}

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

// SetPage sets field value
func (o *PaginatedSandboxes) SetPage(v float32) {
	o.Page = v
}

// GetTotalPages returns the TotalPages field value
func (o *PaginatedSandboxes) GetTotalPages() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.TotalPages
}

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

// SetTotalPages sets field value
func (o *PaginatedSandboxes) SetTotalPages(v float32) {
	o.TotalPages = v
}

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

func (o PaginatedSandboxes) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["items"] = o.Items
	toSerialize["total"] = o.Total
	toSerialize["page"] = o.Page
	toSerialize["totalPages"] = o.TotalPages

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

	return toSerialize, nil
}

func (o *PaginatedSandboxes) 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{
		"items",
		"total",
		"page",
		"totalPages",
	}

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

	varPaginatedSandboxes := _PaginatedSandboxes{}

	err = json.Unmarshal(data, &varPaginatedSandboxes)

	if err != nil {
		return err
	}

	*o = PaginatedSandboxes(varPaginatedSandboxes)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "items")
		delete(additionalProperties, "total")
		delete(additionalProperties, "page")
		delete(additionalProperties, "totalPages")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullablePaginatedSandboxes struct {
	value *PaginatedSandboxes
	isSet bool
}

func (v NullablePaginatedSandboxes) Get() *PaginatedSandboxes {
	return v.value
}

func (v *NullablePaginatedSandboxes) Set(val *PaginatedSandboxes) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePaginatedSandboxes(val *PaginatedSandboxes) *NullablePaginatedSandboxes {
	return &NullablePaginatedSandboxes{value: val, isSet: true}
}

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

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


