/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

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

package client

import (
	"encoding/json"
	"time"
)

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

// Event struct for Event
type Event struct {
	// A unique event identifier generated by the Mender server
	Id *string `json:"id,omitempty"`
	// Type of the event
	Type *string `json:"type,omitempty"`
	DeliveryStatuses []EventDeliveryStatusesInner `json:"delivery_statuses,omitempty"`
	// Creation timestamp
	Time *time.Time `json:"time,omitempty"`
	Data *DeviceAuthEvent `json:"data,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _Event Event

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

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

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

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

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

	return false
}

// SetId gets a reference to the given string and assigns it to the Id field.
func (o *Event) SetId(v string) {
	o.Id = &v
}

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

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

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

	return false
}

// SetType gets a reference to the given string and assigns it to the Type field.
func (o *Event) SetType(v string) {
	o.Type = &v
}

// GetDeliveryStatuses returns the DeliveryStatuses field value if set, zero value otherwise.
func (o *Event) GetDeliveryStatuses() []EventDeliveryStatusesInner {
	if o == nil || IsNil(o.DeliveryStatuses) {
		var ret []EventDeliveryStatusesInner
		return ret
	}
	return o.DeliveryStatuses
}

// GetDeliveryStatusesOk returns a tuple with the DeliveryStatuses field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetDeliveryStatusesOk() ([]EventDeliveryStatusesInner, bool) {
	if o == nil || IsNil(o.DeliveryStatuses) {
		return nil, false
	}
	return o.DeliveryStatuses, true
}

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

	return false
}

// SetDeliveryStatuses gets a reference to the given []EventDeliveryStatusesInner and assigns it to the DeliveryStatuses field.
func (o *Event) SetDeliveryStatuses(v []EventDeliveryStatusesInner) {
	o.DeliveryStatuses = v
}

// GetTime returns the Time field value if set, zero value otherwise.
func (o *Event) GetTime() time.Time {
	if o == nil || IsNil(o.Time) {
		var ret time.Time
		return ret
	}
	return *o.Time
}

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

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

	return false
}

// SetTime gets a reference to the given time.Time and assigns it to the Time field.
func (o *Event) SetTime(v time.Time) {
	o.Time = &v
}

// GetData returns the Data field value if set, zero value otherwise.
func (o *Event) GetData() DeviceAuthEvent {
	if o == nil || IsNil(o.Data) {
		var ret DeviceAuthEvent
		return ret
	}
	return *o.Data
}

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

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

	return false
}

// SetData gets a reference to the given DeviceAuthEvent and assigns it to the Data field.
func (o *Event) SetData(v DeviceAuthEvent) {
	o.Data = &v
}

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

func (o Event) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Id) {
		toSerialize["id"] = o.Id
	}
	if !IsNil(o.Type) {
		toSerialize["type"] = o.Type
	}
	if !IsNil(o.DeliveryStatuses) {
		toSerialize["delivery_statuses"] = o.DeliveryStatuses
	}
	if !IsNil(o.Time) {
		toSerialize["time"] = o.Time
	}
	if !IsNil(o.Data) {
		toSerialize["data"] = o.Data
	}

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

	return toSerialize, nil
}

func (o *Event) UnmarshalJSON(data []byte) (err error) {
	varEvent := _Event{}

	err = json.Unmarshal(data, &varEvent)

	if err != nil {
		return err
	}

	*o = Event(varEvent)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "type")
		delete(additionalProperties, "delivery_statuses")
		delete(additionalProperties, "time")
		delete(additionalProperties, "data")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableEvent struct {
	value *Event
	isSet bool
}

func (v NullableEvent) Get() *Event {
	return v.value
}

func (v *NullableEvent) Set(val *Event) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableEvent(val *Event) *NullableEvent {
	return &NullableEvent{value: val, isSet: true}
}

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

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


