/*
CoinAPI Indexes REST API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: v1
Contact: support@apibricks.io
*/

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

package openapi

import (
	"encoding/json"
	"time"
)

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

// IndexesIndexValue struct for IndexesIndexValue
type IndexesIndexValue struct {
	Timestamp *time.Time `json:"timestamp,omitempty"`
	Value *float64 `json:"value,omitempty"`
	Composition []IndexesIndexValueComponent `json:"composition,omitempty"`
}

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

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

// GetTimestamp returns the Timestamp field value if set, zero value otherwise.
func (o *IndexesIndexValue) GetTimestamp() time.Time {
	if o == nil || IsNil(o.Timestamp) {
		var ret time.Time
		return ret
	}
	return *o.Timestamp
}

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

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

	return false
}

// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field.
func (o *IndexesIndexValue) SetTimestamp(v time.Time) {
	o.Timestamp = &v
}

// GetValue returns the Value field value if set, zero value otherwise.
func (o *IndexesIndexValue) GetValue() float64 {
	if o == nil || IsNil(o.Value) {
		var ret float64
		return ret
	}
	return *o.Value
}

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

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

	return false
}

// SetValue gets a reference to the given float64 and assigns it to the Value field.
func (o *IndexesIndexValue) SetValue(v float64) {
	o.Value = &v
}

// GetComposition returns the Composition field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexValue) GetComposition() []IndexesIndexValueComponent {
	if o == nil {
		var ret []IndexesIndexValueComponent
		return ret
	}
	return o.Composition
}

// GetCompositionOk returns a tuple with the Composition 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 *IndexesIndexValue) GetCompositionOk() ([]IndexesIndexValueComponent, bool) {
	if o == nil || IsNil(o.Composition) {
		return nil, false
	}
	return o.Composition, true
}

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

	return false
}

// SetComposition gets a reference to the given []IndexesIndexValueComponent and assigns it to the Composition field.
func (o *IndexesIndexValue) SetComposition(v []IndexesIndexValueComponent) {
	o.Composition = v
}

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

func (o IndexesIndexValue) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Timestamp) {
		toSerialize["timestamp"] = o.Timestamp
	}
	if !IsNil(o.Value) {
		toSerialize["value"] = o.Value
	}
	if o.Composition != nil {
		toSerialize["composition"] = o.Composition
	}
	return toSerialize, nil
}

type NullableIndexesIndexValue struct {
	value *IndexesIndexValue
	isSet bool
}

func (v NullableIndexesIndexValue) Get() *IndexesIndexValue {
	return v.value
}

func (v *NullableIndexesIndexValue) Set(val *IndexesIndexValue) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableIndexesIndexValue(val *IndexesIndexValue) *NullableIndexesIndexValue {
	return &NullableIndexesIndexValue{value: val, isSet: true}
}

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

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


