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

// PredictionLoggerConfig struct for PredictionLoggerConfig
type PredictionLoggerConfig struct {
	Enabled          bool    `json:"enabled"`
	RawFeaturesTable *string `json:"raw_features_table,omitempty"`
	EntitiesTable    *string `json:"entities_table,omitempty"`
}

type _PredictionLoggerConfig PredictionLoggerConfig

// NewPredictionLoggerConfig instantiates a new PredictionLoggerConfig 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 NewPredictionLoggerConfig(enabled bool) *PredictionLoggerConfig {
	this := PredictionLoggerConfig{}
	this.Enabled = enabled
	return &this
}

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

// GetEnabled returns the Enabled field value
func (o *PredictionLoggerConfig) 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 *PredictionLoggerConfig) GetEnabledOk() (*bool, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Enabled, true
}

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

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

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

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

	return false
}

// SetRawFeaturesTable gets a reference to the given string and assigns it to the RawFeaturesTable field.
func (o *PredictionLoggerConfig) SetRawFeaturesTable(v string) {
	o.RawFeaturesTable = &v
}

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

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

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

	return false
}

// SetEntitiesTable gets a reference to the given string and assigns it to the EntitiesTable field.
func (o *PredictionLoggerConfig) SetEntitiesTable(v string) {
	o.EntitiesTable = &v
}

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

func (o PredictionLoggerConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["enabled"] = o.Enabled
	if !IsNil(o.RawFeaturesTable) {
		toSerialize["raw_features_table"] = o.RawFeaturesTable
	}
	if !IsNil(o.EntitiesTable) {
		toSerialize["entities_table"] = o.EntitiesTable
	}
	return toSerialize, nil
}

func (o *PredictionLoggerConfig) 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",
	}

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

	varPredictionLoggerConfig := _PredictionLoggerConfig{}

	err = json.Unmarshal(bytes, &varPredictionLoggerConfig)

	if err != nil {
		return err
	}

	*o = PredictionLoggerConfig(varPredictionLoggerConfig)

	return err
}

type NullablePredictionLoggerConfig struct {
	value *PredictionLoggerConfig
	isSet bool
}

func (v NullablePredictionLoggerConfig) Get() *PredictionLoggerConfig {
	return v.value
}

func (v *NullablePredictionLoggerConfig) Set(val *PredictionLoggerConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePredictionLoggerConfig(val *PredictionLoggerConfig) *NullablePredictionLoggerConfig {
	return &NullablePredictionLoggerConfig{value: val, isSet: true}
}

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

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