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

// IndexesIndexTimeseriesItem Represents a timeseries item with value information.
type IndexesIndexTimeseriesItem struct {
	// Gets or sets the start time of the time period.
	TimePeriodStart *time.Time `json:"time_period_start,omitempty"`
	// Gets or sets the end time of the time period.
	TimePeriodEnd *time.Time `json:"time_period_end,omitempty"`
	// Gets or sets the time when the value opened.
	TimeOpen NullableTime `json:"time_open,omitempty"`
	// Gets or sets the time when the value closed.
	TimeClose NullableTime `json:"time_close,omitempty"`
	// Gets or sets the opening value.
	ValueOpen NullableFloat64 `json:"value_open,omitempty"`
	// Gets or sets the highest value during the time period.
	ValueHigh NullableFloat64 `json:"value_high,omitempty"`
	// Gets or sets the lowest value during the time period.
	ValueLow NullableFloat64 `json:"value_low,omitempty"`
	// Gets or sets the closing value.
	ValueClose NullableFloat64 `json:"value_close,omitempty"`
	// Gets or sets the number of values during the time period.
	ValueCount *int64 `json:"value_count,omitempty"`
}

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

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

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

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

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

	return false
}

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

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

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

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

	return false
}

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

// GetTimeOpen returns the TimeOpen field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexTimeseriesItem) GetTimeOpen() time.Time {
	if o == nil || IsNil(o.TimeOpen.Get()) {
		var ret time.Time
		return ret
	}
	return *o.TimeOpen.Get()
}

// GetTimeOpenOk returns a tuple with the TimeOpen 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 *IndexesIndexTimeseriesItem) GetTimeOpenOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return o.TimeOpen.Get(), o.TimeOpen.IsSet()
}

// HasTimeOpen returns a boolean if a field has been set.
func (o *IndexesIndexTimeseriesItem) HasTimeOpen() bool {
	if o != nil && o.TimeOpen.IsSet() {
		return true
	}

	return false
}

// SetTimeOpen gets a reference to the given NullableTime and assigns it to the TimeOpen field.
func (o *IndexesIndexTimeseriesItem) SetTimeOpen(v time.Time) {
	o.TimeOpen.Set(&v)
}
// SetTimeOpenNil sets the value for TimeOpen to be an explicit nil
func (o *IndexesIndexTimeseriesItem) SetTimeOpenNil() {
	o.TimeOpen.Set(nil)
}

// UnsetTimeOpen ensures that no value is present for TimeOpen, not even an explicit nil
func (o *IndexesIndexTimeseriesItem) UnsetTimeOpen() {
	o.TimeOpen.Unset()
}

// GetTimeClose returns the TimeClose field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexTimeseriesItem) GetTimeClose() time.Time {
	if o == nil || IsNil(o.TimeClose.Get()) {
		var ret time.Time
		return ret
	}
	return *o.TimeClose.Get()
}

// GetTimeCloseOk returns a tuple with the TimeClose 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 *IndexesIndexTimeseriesItem) GetTimeCloseOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return o.TimeClose.Get(), o.TimeClose.IsSet()
}

// HasTimeClose returns a boolean if a field has been set.
func (o *IndexesIndexTimeseriesItem) HasTimeClose() bool {
	if o != nil && o.TimeClose.IsSet() {
		return true
	}

	return false
}

// SetTimeClose gets a reference to the given NullableTime and assigns it to the TimeClose field.
func (o *IndexesIndexTimeseriesItem) SetTimeClose(v time.Time) {
	o.TimeClose.Set(&v)
}
// SetTimeCloseNil sets the value for TimeClose to be an explicit nil
func (o *IndexesIndexTimeseriesItem) SetTimeCloseNil() {
	o.TimeClose.Set(nil)
}

// UnsetTimeClose ensures that no value is present for TimeClose, not even an explicit nil
func (o *IndexesIndexTimeseriesItem) UnsetTimeClose() {
	o.TimeClose.Unset()
}

// GetValueOpen returns the ValueOpen field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexTimeseriesItem) GetValueOpen() float64 {
	if o == nil || IsNil(o.ValueOpen.Get()) {
		var ret float64
		return ret
	}
	return *o.ValueOpen.Get()
}

// GetValueOpenOk returns a tuple with the ValueOpen 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 *IndexesIndexTimeseriesItem) GetValueOpenOk() (*float64, bool) {
	if o == nil {
		return nil, false
	}
	return o.ValueOpen.Get(), o.ValueOpen.IsSet()
}

// HasValueOpen returns a boolean if a field has been set.
func (o *IndexesIndexTimeseriesItem) HasValueOpen() bool {
	if o != nil && o.ValueOpen.IsSet() {
		return true
	}

	return false
}

// SetValueOpen gets a reference to the given NullableFloat64 and assigns it to the ValueOpen field.
func (o *IndexesIndexTimeseriesItem) SetValueOpen(v float64) {
	o.ValueOpen.Set(&v)
}
// SetValueOpenNil sets the value for ValueOpen to be an explicit nil
func (o *IndexesIndexTimeseriesItem) SetValueOpenNil() {
	o.ValueOpen.Set(nil)
}

// UnsetValueOpen ensures that no value is present for ValueOpen, not even an explicit nil
func (o *IndexesIndexTimeseriesItem) UnsetValueOpen() {
	o.ValueOpen.Unset()
}

// GetValueHigh returns the ValueHigh field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexTimeseriesItem) GetValueHigh() float64 {
	if o == nil || IsNil(o.ValueHigh.Get()) {
		var ret float64
		return ret
	}
	return *o.ValueHigh.Get()
}

// GetValueHighOk returns a tuple with the ValueHigh 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 *IndexesIndexTimeseriesItem) GetValueHighOk() (*float64, bool) {
	if o == nil {
		return nil, false
	}
	return o.ValueHigh.Get(), o.ValueHigh.IsSet()
}

// HasValueHigh returns a boolean if a field has been set.
func (o *IndexesIndexTimeseriesItem) HasValueHigh() bool {
	if o != nil && o.ValueHigh.IsSet() {
		return true
	}

	return false
}

// SetValueHigh gets a reference to the given NullableFloat64 and assigns it to the ValueHigh field.
func (o *IndexesIndexTimeseriesItem) SetValueHigh(v float64) {
	o.ValueHigh.Set(&v)
}
// SetValueHighNil sets the value for ValueHigh to be an explicit nil
func (o *IndexesIndexTimeseriesItem) SetValueHighNil() {
	o.ValueHigh.Set(nil)
}

// UnsetValueHigh ensures that no value is present for ValueHigh, not even an explicit nil
func (o *IndexesIndexTimeseriesItem) UnsetValueHigh() {
	o.ValueHigh.Unset()
}

// GetValueLow returns the ValueLow field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexTimeseriesItem) GetValueLow() float64 {
	if o == nil || IsNil(o.ValueLow.Get()) {
		var ret float64
		return ret
	}
	return *o.ValueLow.Get()
}

// GetValueLowOk returns a tuple with the ValueLow 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 *IndexesIndexTimeseriesItem) GetValueLowOk() (*float64, bool) {
	if o == nil {
		return nil, false
	}
	return o.ValueLow.Get(), o.ValueLow.IsSet()
}

// HasValueLow returns a boolean if a field has been set.
func (o *IndexesIndexTimeseriesItem) HasValueLow() bool {
	if o != nil && o.ValueLow.IsSet() {
		return true
	}

	return false
}

// SetValueLow gets a reference to the given NullableFloat64 and assigns it to the ValueLow field.
func (o *IndexesIndexTimeseriesItem) SetValueLow(v float64) {
	o.ValueLow.Set(&v)
}
// SetValueLowNil sets the value for ValueLow to be an explicit nil
func (o *IndexesIndexTimeseriesItem) SetValueLowNil() {
	o.ValueLow.Set(nil)
}

// UnsetValueLow ensures that no value is present for ValueLow, not even an explicit nil
func (o *IndexesIndexTimeseriesItem) UnsetValueLow() {
	o.ValueLow.Unset()
}

// GetValueClose returns the ValueClose field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *IndexesIndexTimeseriesItem) GetValueClose() float64 {
	if o == nil || IsNil(o.ValueClose.Get()) {
		var ret float64
		return ret
	}
	return *o.ValueClose.Get()
}

// GetValueCloseOk returns a tuple with the ValueClose 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 *IndexesIndexTimeseriesItem) GetValueCloseOk() (*float64, bool) {
	if o == nil {
		return nil, false
	}
	return o.ValueClose.Get(), o.ValueClose.IsSet()
}

// HasValueClose returns a boolean if a field has been set.
func (o *IndexesIndexTimeseriesItem) HasValueClose() bool {
	if o != nil && o.ValueClose.IsSet() {
		return true
	}

	return false
}

// SetValueClose gets a reference to the given NullableFloat64 and assigns it to the ValueClose field.
func (o *IndexesIndexTimeseriesItem) SetValueClose(v float64) {
	o.ValueClose.Set(&v)
}
// SetValueCloseNil sets the value for ValueClose to be an explicit nil
func (o *IndexesIndexTimeseriesItem) SetValueCloseNil() {
	o.ValueClose.Set(nil)
}

// UnsetValueClose ensures that no value is present for ValueClose, not even an explicit nil
func (o *IndexesIndexTimeseriesItem) UnsetValueClose() {
	o.ValueClose.Unset()
}

// GetValueCount returns the ValueCount field value if set, zero value otherwise.
func (o *IndexesIndexTimeseriesItem) GetValueCount() int64 {
	if o == nil || IsNil(o.ValueCount) {
		var ret int64
		return ret
	}
	return *o.ValueCount
}

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

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

	return false
}

// SetValueCount gets a reference to the given int64 and assigns it to the ValueCount field.
func (o *IndexesIndexTimeseriesItem) SetValueCount(v int64) {
	o.ValueCount = &v
}

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

func (o IndexesIndexTimeseriesItem) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.TimePeriodStart) {
		toSerialize["time_period_start"] = o.TimePeriodStart
	}
	if !IsNil(o.TimePeriodEnd) {
		toSerialize["time_period_end"] = o.TimePeriodEnd
	}
	if o.TimeOpen.IsSet() {
		toSerialize["time_open"] = o.TimeOpen.Get()
	}
	if o.TimeClose.IsSet() {
		toSerialize["time_close"] = o.TimeClose.Get()
	}
	if o.ValueOpen.IsSet() {
		toSerialize["value_open"] = o.ValueOpen.Get()
	}
	if o.ValueHigh.IsSet() {
		toSerialize["value_high"] = o.ValueHigh.Get()
	}
	if o.ValueLow.IsSet() {
		toSerialize["value_low"] = o.ValueLow.Get()
	}
	if o.ValueClose.IsSet() {
		toSerialize["value_close"] = o.ValueClose.Get()
	}
	if !IsNil(o.ValueCount) {
		toSerialize["value_count"] = o.ValueCount
	}
	return toSerialize, nil
}

type NullableIndexesIndexTimeseriesItem struct {
	value *IndexesIndexTimeseriesItem
	isSet bool
}

func (v NullableIndexesIndexTimeseriesItem) Get() *IndexesIndexTimeseriesItem {
	return v.value
}

func (v *NullableIndexesIndexTimeseriesItem) Set(val *IndexesIndexTimeseriesItem) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableIndexesIndexTimeseriesItem(val *IndexesIndexTimeseriesItem) *NullableIndexesIndexTimeseriesItem {
	return &NullableIndexesIndexTimeseriesItem{value: val, isSet: true}
}

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

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


