/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.21
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package hindsight

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

// AuditLogStatsBucket A single time bucket in audit log stats.
type AuditLogStatsBucket struct {
	Time string `json:"time"`
	Actions map[string]int32 `json:"actions"`
	Total int32 `json:"total"`
}

type _AuditLogStatsBucket AuditLogStatsBucket

// NewAuditLogStatsBucket instantiates a new AuditLogStatsBucket 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 NewAuditLogStatsBucket(time string, actions map[string]int32, total int32) *AuditLogStatsBucket {
	this := AuditLogStatsBucket{}
	this.Time = time
	this.Actions = actions
	this.Total = total
	return &this
}

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

// GetTime returns the Time field value
func (o *AuditLogStatsBucket) GetTime() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Time
}

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

// SetTime sets field value
func (o *AuditLogStatsBucket) SetTime(v string) {
	o.Time = v
}

// GetActions returns the Actions field value
func (o *AuditLogStatsBucket) GetActions() map[string]int32 {
	if o == nil {
		var ret map[string]int32
		return ret
	}

	return o.Actions
}

// GetActionsOk returns a tuple with the Actions field value
// and a boolean to check if the value has been set.
func (o *AuditLogStatsBucket) GetActionsOk() (map[string]int32, bool) {
	if o == nil {
		return map[string]int32{}, false
	}
	return o.Actions, true
}

// SetActions sets field value
func (o *AuditLogStatsBucket) SetActions(v map[string]int32) {
	o.Actions = v
}

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

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

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

func (o AuditLogStatsBucket) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["time"] = o.Time
	toSerialize["actions"] = o.Actions
	toSerialize["total"] = o.Total
	return toSerialize, nil
}

func (o *AuditLogStatsBucket) 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{
		"time",
		"actions",
		"total",
	}

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

	varAuditLogStatsBucket := _AuditLogStatsBucket{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varAuditLogStatsBucket)

	if err != nil {
		return err
	}

	*o = AuditLogStatsBucket(varAuditLogStatsBucket)

	return err
}

type NullableAuditLogStatsBucket struct {
	value *AuditLogStatsBucket
	isSet bool
}

func (v NullableAuditLogStatsBucket) Get() *AuditLogStatsBucket {
	return v.value
}

func (v *NullableAuditLogStatsBucket) Set(val *AuditLogStatsBucket) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAuditLogStatsBucket(val *AuditLogStatsBucket) *NullableAuditLogStatsBucket {
	return &NullableAuditLogStatsBucket{value: val, isSet: true}
}

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

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


