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

// OrganizationUsageOverview struct for OrganizationUsageOverview
type OrganizationUsageOverview struct {
	RegionUsage []RegionUsageOverview `json:"regionUsage"`
	TotalSnapshotQuota float32 `json:"totalSnapshotQuota"`
	CurrentSnapshotUsage float32 `json:"currentSnapshotUsage"`
	TotalVolumeQuota float32 `json:"totalVolumeQuota"`
	CurrentVolumeUsage float32 `json:"currentVolumeUsage"`
	AdditionalProperties map[string]interface{}
}

type _OrganizationUsageOverview OrganizationUsageOverview

// NewOrganizationUsageOverview instantiates a new OrganizationUsageOverview 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 NewOrganizationUsageOverview(regionUsage []RegionUsageOverview, totalSnapshotQuota float32, currentSnapshotUsage float32, totalVolumeQuota float32, currentVolumeUsage float32) *OrganizationUsageOverview {
	this := OrganizationUsageOverview{}
	this.RegionUsage = regionUsage
	this.TotalSnapshotQuota = totalSnapshotQuota
	this.CurrentSnapshotUsage = currentSnapshotUsage
	this.TotalVolumeQuota = totalVolumeQuota
	this.CurrentVolumeUsage = currentVolumeUsage
	return &this
}

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

// GetRegionUsage returns the RegionUsage field value
func (o *OrganizationUsageOverview) GetRegionUsage() []RegionUsageOverview {
	if o == nil {
		var ret []RegionUsageOverview
		return ret
	}

	return o.RegionUsage
}

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

// SetRegionUsage sets field value
func (o *OrganizationUsageOverview) SetRegionUsage(v []RegionUsageOverview) {
	o.RegionUsage = v
}

// GetTotalSnapshotQuota returns the TotalSnapshotQuota field value
func (o *OrganizationUsageOverview) GetTotalSnapshotQuota() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.TotalSnapshotQuota
}

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

// SetTotalSnapshotQuota sets field value
func (o *OrganizationUsageOverview) SetTotalSnapshotQuota(v float32) {
	o.TotalSnapshotQuota = v
}

// GetCurrentSnapshotUsage returns the CurrentSnapshotUsage field value
func (o *OrganizationUsageOverview) GetCurrentSnapshotUsage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentSnapshotUsage
}

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

// SetCurrentSnapshotUsage sets field value
func (o *OrganizationUsageOverview) SetCurrentSnapshotUsage(v float32) {
	o.CurrentSnapshotUsage = v
}

// GetTotalVolumeQuota returns the TotalVolumeQuota field value
func (o *OrganizationUsageOverview) GetTotalVolumeQuota() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.TotalVolumeQuota
}

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

// SetTotalVolumeQuota sets field value
func (o *OrganizationUsageOverview) SetTotalVolumeQuota(v float32) {
	o.TotalVolumeQuota = v
}

// GetCurrentVolumeUsage returns the CurrentVolumeUsage field value
func (o *OrganizationUsageOverview) GetCurrentVolumeUsage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentVolumeUsage
}

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

// SetCurrentVolumeUsage sets field value
func (o *OrganizationUsageOverview) SetCurrentVolumeUsage(v float32) {
	o.CurrentVolumeUsage = v
}

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

func (o OrganizationUsageOverview) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["regionUsage"] = o.RegionUsage
	toSerialize["totalSnapshotQuota"] = o.TotalSnapshotQuota
	toSerialize["currentSnapshotUsage"] = o.CurrentSnapshotUsage
	toSerialize["totalVolumeQuota"] = o.TotalVolumeQuota
	toSerialize["currentVolumeUsage"] = o.CurrentVolumeUsage

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

	return toSerialize, nil
}

func (o *OrganizationUsageOverview) 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{
		"regionUsage",
		"totalSnapshotQuota",
		"currentSnapshotUsage",
		"totalVolumeQuota",
		"currentVolumeUsage",
	}

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

	varOrganizationUsageOverview := _OrganizationUsageOverview{}

	err = json.Unmarshal(data, &varOrganizationUsageOverview)

	if err != nil {
		return err
	}

	*o = OrganizationUsageOverview(varOrganizationUsageOverview)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "regionUsage")
		delete(additionalProperties, "totalSnapshotQuota")
		delete(additionalProperties, "currentSnapshotUsage")
		delete(additionalProperties, "totalVolumeQuota")
		delete(additionalProperties, "currentVolumeUsage")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableOrganizationUsageOverview struct {
	value *OrganizationUsageOverview
	isSet bool
}

func (v NullableOrganizationUsageOverview) Get() *OrganizationUsageOverview {
	return v.value
}

func (v *NullableOrganizationUsageOverview) Set(val *OrganizationUsageOverview) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOrganizationUsageOverview(val *OrganizationUsageOverview) *NullableOrganizationUsageOverview {
	return &NullableOrganizationUsageOverview{value: val, isSet: true}
}

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

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


