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

// AuditLogEntry A single audit log entry.
type AuditLogEntry struct {
	Id string `json:"id"`
	Action string `json:"action"`
	Transport string `json:"transport"`
	BankId NullableString `json:"bank_id"`
	StartedAt NullableString `json:"started_at"`
	EndedAt NullableString `json:"ended_at"`
	DurationMs NullableInt32 `json:"duration_ms,omitempty"`
	Request map[string]interface{} `json:"request"`
	Response map[string]interface{} `json:"response"`
	Metadata map[string]interface{} `json:"metadata"`
}

type _AuditLogEntry AuditLogEntry

// NewAuditLogEntry instantiates a new AuditLogEntry 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 NewAuditLogEntry(id string, action string, transport string, bankId NullableString, startedAt NullableString, endedAt NullableString, request map[string]interface{}, response map[string]interface{}, metadata map[string]interface{}) *AuditLogEntry {
	this := AuditLogEntry{}
	this.Id = id
	this.Action = action
	this.Transport = transport
	this.BankId = bankId
	this.StartedAt = startedAt
	this.EndedAt = endedAt
	this.Request = request
	this.Response = response
	this.Metadata = metadata
	return &this
}

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

// GetId returns the Id field value
func (o *AuditLogEntry) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *AuditLogEntry) SetId(v string) {
	o.Id = v
}

// GetAction returns the Action field value
func (o *AuditLogEntry) GetAction() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Action
}

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

// SetAction sets field value
func (o *AuditLogEntry) SetAction(v string) {
	o.Action = v
}

// GetTransport returns the Transport field value
func (o *AuditLogEntry) GetTransport() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Transport
}

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

// SetTransport sets field value
func (o *AuditLogEntry) SetTransport(v string) {
	o.Transport = v
}

// GetBankId returns the BankId field value
// If the value is explicit nil, the zero value for string will be returned
func (o *AuditLogEntry) GetBankId() string {
	if o == nil || o.BankId.Get() == nil {
		var ret string
		return ret
	}

	return *o.BankId.Get()
}

// GetBankIdOk returns a tuple with the BankId field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AuditLogEntry) GetBankIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.BankId.Get(), o.BankId.IsSet()
}

// SetBankId sets field value
func (o *AuditLogEntry) SetBankId(v string) {
	o.BankId.Set(&v)
}

// GetStartedAt returns the StartedAt field value
// If the value is explicit nil, the zero value for string will be returned
func (o *AuditLogEntry) GetStartedAt() string {
	if o == nil || o.StartedAt.Get() == nil {
		var ret string
		return ret
	}

	return *o.StartedAt.Get()
}

// GetStartedAtOk returns a tuple with the StartedAt field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AuditLogEntry) GetStartedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.StartedAt.Get(), o.StartedAt.IsSet()
}

// SetStartedAt sets field value
func (o *AuditLogEntry) SetStartedAt(v string) {
	o.StartedAt.Set(&v)
}

// GetEndedAt returns the EndedAt field value
// If the value is explicit nil, the zero value for string will be returned
func (o *AuditLogEntry) GetEndedAt() string {
	if o == nil || o.EndedAt.Get() == nil {
		var ret string
		return ret
	}

	return *o.EndedAt.Get()
}

// GetEndedAtOk returns a tuple with the EndedAt field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AuditLogEntry) GetEndedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.EndedAt.Get(), o.EndedAt.IsSet()
}

// SetEndedAt sets field value
func (o *AuditLogEntry) SetEndedAt(v string) {
	o.EndedAt.Set(&v)
}

// GetDurationMs returns the DurationMs field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *AuditLogEntry) GetDurationMs() int32 {
	if o == nil || IsNil(o.DurationMs.Get()) {
		var ret int32
		return ret
	}
	return *o.DurationMs.Get()
}

// GetDurationMsOk returns a tuple with the DurationMs field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AuditLogEntry) GetDurationMsOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return o.DurationMs.Get(), o.DurationMs.IsSet()
}

// HasDurationMs returns a boolean if a field has been set.
func (o *AuditLogEntry) HasDurationMs() bool {
	if o != nil && o.DurationMs.IsSet() {
		return true
	}

	return false
}

// SetDurationMs gets a reference to the given NullableInt32 and assigns it to the DurationMs field.
func (o *AuditLogEntry) SetDurationMs(v int32) {
	o.DurationMs.Set(&v)
}
// SetDurationMsNil sets the value for DurationMs to be an explicit nil
func (o *AuditLogEntry) SetDurationMsNil() {
	o.DurationMs.Set(nil)
}

// UnsetDurationMs ensures that no value is present for DurationMs, not even an explicit nil
func (o *AuditLogEntry) UnsetDurationMs() {
	o.DurationMs.Unset()
}

// GetRequest returns the Request field value
// If the value is explicit nil, the zero value for map[string]interface{} will be returned
func (o *AuditLogEntry) GetRequest() map[string]interface{} {
	if o == nil {
		var ret map[string]interface{}
		return ret
	}

	return o.Request
}

// GetRequestOk returns a tuple with the Request field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AuditLogEntry) GetRequestOk() (map[string]interface{}, bool) {
	if o == nil || IsNil(o.Request) {
		return map[string]interface{}{}, false
	}
	return o.Request, true
}

// SetRequest sets field value
func (o *AuditLogEntry) SetRequest(v map[string]interface{}) {
	o.Request = v
}

// GetResponse returns the Response field value
// If the value is explicit nil, the zero value for map[string]interface{} will be returned
func (o *AuditLogEntry) GetResponse() map[string]interface{} {
	if o == nil {
		var ret map[string]interface{}
		return ret
	}

	return o.Response
}

// GetResponseOk returns a tuple with the Response field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AuditLogEntry) GetResponseOk() (map[string]interface{}, bool) {
	if o == nil || IsNil(o.Response) {
		return map[string]interface{}{}, false
	}
	return o.Response, true
}

// SetResponse sets field value
func (o *AuditLogEntry) SetResponse(v map[string]interface{}) {
	o.Response = v
}

// GetMetadata returns the Metadata field value
func (o *AuditLogEntry) GetMetadata() map[string]interface{} {
	if o == nil {
		var ret map[string]interface{}
		return ret
	}

	return o.Metadata
}

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

// SetMetadata sets field value
func (o *AuditLogEntry) SetMetadata(v map[string]interface{}) {
	o.Metadata = v
}

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

func (o AuditLogEntry) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["action"] = o.Action
	toSerialize["transport"] = o.Transport
	toSerialize["bank_id"] = o.BankId.Get()
	toSerialize["started_at"] = o.StartedAt.Get()
	toSerialize["ended_at"] = o.EndedAt.Get()
	if o.DurationMs.IsSet() {
		toSerialize["duration_ms"] = o.DurationMs.Get()
	}
	if o.Request != nil {
		toSerialize["request"] = o.Request
	}
	if o.Response != nil {
		toSerialize["response"] = o.Response
	}
	toSerialize["metadata"] = o.Metadata
	return toSerialize, nil
}

func (o *AuditLogEntry) 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{
		"id",
		"action",
		"transport",
		"bank_id",
		"started_at",
		"ended_at",
		"request",
		"response",
		"metadata",
	}

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

	varAuditLogEntry := _AuditLogEntry{}

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

	if err != nil {
		return err
	}

	*o = AuditLogEntry(varAuditLogEntry)

	return err
}

type NullableAuditLogEntry struct {
	value *AuditLogEntry
	isSet bool
}

func (v NullableAuditLogEntry) Get() *AuditLogEntry {
	return v.value
}

func (v *NullableAuditLogEntry) Set(val *AuditLogEntry) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAuditLogEntry(val *AuditLogEntry) *NullableAuditLogEntry {
	return &NullableAuditLogEntry{value: val, isSet: true}
}

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

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


