/*
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"
	"fmt"
)

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

// DeploymentLogMessagesInner struct for DeploymentLogMessagesInner
type DeploymentLogMessagesInner struct {
	Timestamp time.Time `json:"timestamp"`
	Level string `json:"level"`
	Message string `json:"message"`
	AdditionalProperties map[string]interface{}
}

type _DeploymentLogMessagesInner DeploymentLogMessagesInner

// NewDeploymentLogMessagesInner instantiates a new DeploymentLogMessagesInner 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 NewDeploymentLogMessagesInner(timestamp time.Time, level string, message string) *DeploymentLogMessagesInner {
	this := DeploymentLogMessagesInner{}
	this.Timestamp = timestamp
	this.Level = level
	this.Message = message
	return &this
}

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

// GetTimestamp returns the Timestamp field value
func (o *DeploymentLogMessagesInner) GetTimestamp() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.Timestamp
}

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

// SetTimestamp sets field value
func (o *DeploymentLogMessagesInner) SetTimestamp(v time.Time) {
	o.Timestamp = v
}

// GetLevel returns the Level field value
func (o *DeploymentLogMessagesInner) GetLevel() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Level
}

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

// SetLevel sets field value
func (o *DeploymentLogMessagesInner) SetLevel(v string) {
	o.Level = v
}

// GetMessage returns the Message field value
func (o *DeploymentLogMessagesInner) GetMessage() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Message
}

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

// SetMessage sets field value
func (o *DeploymentLogMessagesInner) SetMessage(v string) {
	o.Message = v
}

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

func (o DeploymentLogMessagesInner) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["timestamp"] = o.Timestamp
	toSerialize["level"] = o.Level
	toSerialize["message"] = o.Message

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

	return toSerialize, nil
}

func (o *DeploymentLogMessagesInner) 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{
		"timestamp",
		"level",
		"message",
	}

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

	varDeploymentLogMessagesInner := _DeploymentLogMessagesInner{}

	err = json.Unmarshal(data, &varDeploymentLogMessagesInner)

	if err != nil {
		return err
	}

	*o = DeploymentLogMessagesInner(varDeploymentLogMessagesInner)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "timestamp")
		delete(additionalProperties, "level")
		delete(additionalProperties, "message")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableDeploymentLogMessagesInner struct {
	value *DeploymentLogMessagesInner
	isSet bool
}

func (v NullableDeploymentLogMessagesInner) Get() *DeploymentLogMessagesInner {
	return v.value
}

func (v *NullableDeploymentLogMessagesInner) Set(val *DeploymentLogMessagesInner) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeploymentLogMessagesInner(val *DeploymentLogMessagesInner) *NullableDeploymentLogMessagesInner {
	return &NullableDeploymentLogMessagesInner{value: val, isSet: true}
}

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

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


