/*
Merlin

API Guide for accessing Merlin's model management, deployment, and serving functionalities

API version: 0.14.0
*/

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

package client

import (
	"encoding/json"
	"fmt"
)

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

// LoggerConfig struct for LoggerConfig
type LoggerConfig struct {
	Enabled bool       `json:"enabled"`
	Mode    LoggerMode `json:"mode"`
}

type _LoggerConfig LoggerConfig

// NewLoggerConfig instantiates a new LoggerConfig 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 NewLoggerConfig(enabled bool, mode LoggerMode) *LoggerConfig {
	this := LoggerConfig{}
	this.Enabled = enabled
	this.Mode = mode
	return &this
}

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

// GetEnabled returns the Enabled field value
func (o *LoggerConfig) GetEnabled() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.Enabled
}

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

// SetEnabled sets field value
func (o *LoggerConfig) SetEnabled(v bool) {
	o.Enabled = v
}

// GetMode returns the Mode field value
func (o *LoggerConfig) GetMode() LoggerMode {
	if o == nil {
		var ret LoggerMode
		return ret
	}

	return o.Mode
}

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

// SetMode sets field value
func (o *LoggerConfig) SetMode(v LoggerMode) {
	o.Mode = v
}

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

func (o LoggerConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["enabled"] = o.Enabled
	toSerialize["mode"] = o.Mode
	return toSerialize, nil
}

func (o *LoggerConfig) UnmarshalJSON(bytes []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{
		"enabled",
		"mode",
	}

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

	err = json.Unmarshal(bytes, &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)
		}
	}

	varLoggerConfig := _LoggerConfig{}

	err = json.Unmarshal(bytes, &varLoggerConfig)

	if err != nil {
		return err
	}

	*o = LoggerConfig(varLoggerConfig)

	return err
}

type NullableLoggerConfig struct {
	value *LoggerConfig
	isSet bool
}

func (v NullableLoggerConfig) Get() *LoggerConfig {
	return v.value
}

func (v *NullableLoggerConfig) Set(val *LoggerConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLoggerConfig(val *LoggerConfig) *NullableLoggerConfig {
	return &NullableLoggerConfig{value: val, isSet: true}
}

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

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