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

// PaginatedAuditLogs struct for PaginatedAuditLogs
type PaginatedAuditLogs struct {
	Items []AuditLog `json:"items"`
	Total float32 `json:"total"`
	Page float32 `json:"page"`
	TotalPages float32 `json:"totalPages"`
	// Token for next page in cursor-based pagination
	NextToken *string `json:"nextToken,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _PaginatedAuditLogs PaginatedAuditLogs

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

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

// GetItems returns the Items field value
func (o *PaginatedAuditLogs) GetItems() []AuditLog {
	if o == nil {
		var ret []AuditLog
		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 *PaginatedAuditLogs) GetItemsOk() ([]AuditLog, bool) {
	if o == nil {
		return nil, false
	}
	return o.Items, true
}

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

// GetTotal returns the Total field value
func (o *PaginatedAuditLogs) 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 *PaginatedAuditLogs) GetTotalOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Total, true
}

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

// GetPage returns the Page field value
func (o *PaginatedAuditLogs) 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 *PaginatedAuditLogs) GetPageOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Page, true
}

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

// GetTotalPages returns the TotalPages field value
func (o *PaginatedAuditLogs) 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 *PaginatedAuditLogs) GetTotalPagesOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.TotalPages, true
}

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

// GetNextToken returns the NextToken field value if set, zero value otherwise.
func (o *PaginatedAuditLogs) GetNextToken() string {
	if o == nil || IsNil(o.NextToken) {
		var ret string
		return ret
	}
	return *o.NextToken
}

// GetNextTokenOk returns a tuple with the NextToken field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PaginatedAuditLogs) GetNextTokenOk() (*string, bool) {
	if o == nil || IsNil(o.NextToken) {
		return nil, false
	}
	return o.NextToken, true
}

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

	return false
}

// SetNextToken gets a reference to the given string and assigns it to the NextToken field.
func (o *PaginatedAuditLogs) SetNextToken(v string) {
	o.NextToken = &v
}

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

func (o PaginatedAuditLogs) 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
	if !IsNil(o.NextToken) {
		toSerialize["nextToken"] = o.NextToken
	}

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

	return toSerialize, nil
}

func (o *PaginatedAuditLogs) 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)
		}
	}

	varPaginatedAuditLogs := _PaginatedAuditLogs{}

	err = json.Unmarshal(data, &varPaginatedAuditLogs)

	if err != nil {
		return err
	}

	*o = PaginatedAuditLogs(varPaginatedAuditLogs)

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

	return err
}

type NullablePaginatedAuditLogs struct {
	value *PaginatedAuditLogs
	isSet bool
}

func (v NullablePaginatedAuditLogs) Get() *PaginatedAuditLogs {
	return v.value
}

func (v *NullablePaginatedAuditLogs) Set(val *PaginatedAuditLogs) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePaginatedAuditLogs(val *PaginatedAuditLogs) *NullablePaginatedAuditLogs {
	return &NullablePaginatedAuditLogs{value: val, isSet: true}
}

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

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


