/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
	"fmt"
)

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

// OtelConfig struct for OtelConfig
type OtelConfig struct {
	// Endpoint
	Endpoint string `json:"endpoint"`
	// Headers
	Headers map[string]string `json:"headers,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _OtelConfig OtelConfig

// NewOtelConfig instantiates a new OtelConfig 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 NewOtelConfig(endpoint string) *OtelConfig {
	this := OtelConfig{}
	this.Endpoint = endpoint
	return &this
}

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

// GetEndpoint returns the Endpoint field value
func (o *OtelConfig) GetEndpoint() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Endpoint
}

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

// SetEndpoint sets field value
func (o *OtelConfig) SetEndpoint(v string) {
	o.Endpoint = v
}

// GetHeaders returns the Headers field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OtelConfig) GetHeaders() map[string]string {
	if o == nil {
		var ret map[string]string
		return ret
	}
	return o.Headers
}

// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *OtelConfig) GetHeadersOk() (*map[string]string, bool) {
	if o == nil || IsNil(o.Headers) {
		return nil, false
	}
	return &o.Headers, true
}

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

	return false
}

// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field.
func (o *OtelConfig) SetHeaders(v map[string]string) {
	o.Headers = v
}

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

func (o OtelConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["endpoint"] = o.Endpoint
	if o.Headers != nil {
		toSerialize["headers"] = o.Headers
	}

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

	return toSerialize, nil
}

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

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

	varOtelConfig := _OtelConfig{}

	err = json.Unmarshal(data, &varOtelConfig)

	if err != nil {
		return err
	}

	*o = OtelConfig(varOtelConfig)

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

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

	return err
}

type NullableOtelConfig struct {
	value *OtelConfig
	isSet bool
}

func (v NullableOtelConfig) Get() *OtelConfig {
	return v.value
}

func (v *NullableOtelConfig) Set(val *OtelConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOtelConfig(val *OtelConfig) *NullableOtelConfig {
	return &NullableOtelConfig{value: val, isSet: true}
}

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

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


