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

// MountedMLPSecret struct for MountedMLPSecret
type MountedMLPSecret struct {
	MlpSecretName string `json:"mlp_secret_name"`
	EnvVarName    string `json:"env_var_name"`
}

type _MountedMLPSecret MountedMLPSecret

// NewMountedMLPSecret instantiates a new MountedMLPSecret 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 NewMountedMLPSecret(mlpSecretName string, envVarName string) *MountedMLPSecret {
	this := MountedMLPSecret{}
	this.MlpSecretName = mlpSecretName
	this.EnvVarName = envVarName
	return &this
}

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

// GetMlpSecretName returns the MlpSecretName field value
func (o *MountedMLPSecret) GetMlpSecretName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.MlpSecretName
}

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

// SetMlpSecretName sets field value
func (o *MountedMLPSecret) SetMlpSecretName(v string) {
	o.MlpSecretName = v
}

// GetEnvVarName returns the EnvVarName field value
func (o *MountedMLPSecret) GetEnvVarName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.EnvVarName
}

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

// SetEnvVarName sets field value
func (o *MountedMLPSecret) SetEnvVarName(v string) {
	o.EnvVarName = v
}

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

func (o MountedMLPSecret) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["mlp_secret_name"] = o.MlpSecretName
	toSerialize["env_var_name"] = o.EnvVarName
	return toSerialize, nil
}

func (o *MountedMLPSecret) 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{
		"mlp_secret_name",
		"env_var_name",
	}

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

	varMountedMLPSecret := _MountedMLPSecret{}

	err = json.Unmarshal(bytes, &varMountedMLPSecret)

	if err != nil {
		return err
	}

	*o = MountedMLPSecret(varMountedMLPSecret)

	return err
}

type NullableMountedMLPSecret struct {
	value *MountedMLPSecret
	isSet bool
}

func (v NullableMountedMLPSecret) Get() *MountedMLPSecret {
	return v.value
}

func (v *NullableMountedMLPSecret) Set(val *MountedMLPSecret) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMountedMLPSecret(val *MountedMLPSecret) *NullableMountedMLPSecret {
	return &NullableMountedMLPSecret{value: val, isSet: true}
}

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

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