/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.5.3
*/

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

package hindsight

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

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

// AuditLogStatsResponse Response model for audit log stats endpoint.
type AuditLogStatsResponse struct {
	BankId string `json:"bank_id"`
	Period string `json:"period"`
	Trunc string `json:"trunc"`
	Start string `json:"start"`
	Buckets []AuditLogStatsBucket `json:"buckets"`
}

type _AuditLogStatsResponse AuditLogStatsResponse

// NewAuditLogStatsResponse instantiates a new AuditLogStatsResponse 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 NewAuditLogStatsResponse(bankId string, period string, trunc string, start string, buckets []AuditLogStatsBucket) *AuditLogStatsResponse {
	this := AuditLogStatsResponse{}
	this.BankId = bankId
	this.Period = period
	this.Trunc = trunc
	this.Start = start
	this.Buckets = buckets
	return &this
}

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

// GetBankId returns the BankId field value
func (o *AuditLogStatsResponse) GetBankId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.BankId
}

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

// SetBankId sets field value
func (o *AuditLogStatsResponse) SetBankId(v string) {
	o.BankId = v
}

// GetPeriod returns the Period field value
func (o *AuditLogStatsResponse) GetPeriod() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Period
}

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

// SetPeriod sets field value
func (o *AuditLogStatsResponse) SetPeriod(v string) {
	o.Period = v
}

// GetTrunc returns the Trunc field value
func (o *AuditLogStatsResponse) GetTrunc() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Trunc
}

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

// SetTrunc sets field value
func (o *AuditLogStatsResponse) SetTrunc(v string) {
	o.Trunc = v
}

// GetStart returns the Start field value
func (o *AuditLogStatsResponse) GetStart() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Start
}

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

// SetStart sets field value
func (o *AuditLogStatsResponse) SetStart(v string) {
	o.Start = v
}

// GetBuckets returns the Buckets field value
func (o *AuditLogStatsResponse) GetBuckets() []AuditLogStatsBucket {
	if o == nil {
		var ret []AuditLogStatsBucket
		return ret
	}

	return o.Buckets
}

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

// SetBuckets sets field value
func (o *AuditLogStatsResponse) SetBuckets(v []AuditLogStatsBucket) {
	o.Buckets = v
}

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

func (o AuditLogStatsResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["bank_id"] = o.BankId
	toSerialize["period"] = o.Period
	toSerialize["trunc"] = o.Trunc
	toSerialize["start"] = o.Start
	toSerialize["buckets"] = o.Buckets
	return toSerialize, nil
}

func (o *AuditLogStatsResponse) 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{
		"bank_id",
		"period",
		"trunc",
		"start",
		"buckets",
	}

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

	varAuditLogStatsResponse := _AuditLogStatsResponse{}

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

	if err != nil {
		return err
	}

	*o = AuditLogStatsResponse(varAuditLogStatsResponse)

	return err
}

type NullableAuditLogStatsResponse struct {
	value *AuditLogStatsResponse
	isSet bool
}

func (v NullableAuditLogStatsResponse) Get() *AuditLogStatsResponse {
	return v.value
}

func (v *NullableAuditLogStatsResponse) Set(val *AuditLogStatsResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAuditLogStatsResponse(val *AuditLogStatsResponse) *NullableAuditLogStatsResponse {
	return &NullableAuditLogStatsResponse{value: val, isSet: true}
}

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

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


