/*
 * Kafka as a Service API
 *
 * An managed Apache Kafka cluster is designed to be highly fault-tolerant and scalable, allowing large volumes of data to be ingested, stored, and processed in real-time. By distributing data across multiple brokers, Kafka achieves high throughput and low latency, making it suitable for applications requiring real-time data processing and analytics.
 *
 * API version: 1.7.1
 * Contact: support@cloud.ionos.com
 */

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

package ionoscloud

import (
	"encoding/json"
)

// TopicLogRetention struct for TopicLogRetention
type TopicLogRetention struct {
	// This configuration controls the maximum time we will retain a log before we will discard old log  segments to free up space.  This represents an SLA on how soon consumers must read their data. If set to -1,  no time limit is applied.
	RetentionTime *int32 `json:"retentionTime,omitempty"`
	// This configuration controls the segment file size for the log. Retention and cleaning is always done a file at a time so a larger segment size means fewer files but less granular control over retention.
	SegmentBytes *int32 `json:"segmentBytes,omitempty"`
}

// NewTopicLogRetention instantiates a new TopicLogRetention 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 NewTopicLogRetention() *TopicLogRetention {
	this := TopicLogRetention{}

	var retentionTime int32 = 604800000
	this.RetentionTime = &retentionTime
	var segmentBytes int32 = 1073741824
	this.SegmentBytes = &segmentBytes

	return &this
}

// NewTopicLogRetentionWithDefaults instantiates a new TopicLogRetention 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 NewTopicLogRetentionWithDefaults() *TopicLogRetention {
	this := TopicLogRetention{}
	var retentionTime int32 = 604800000
	this.RetentionTime = &retentionTime
	var segmentBytes int32 = 1073741824
	this.SegmentBytes = &segmentBytes
	return &this
}

// GetRetentionTime returns the RetentionTime field value
// If the value is explicit nil, the zero value for int32 will be returned
func (o *TopicLogRetention) GetRetentionTime() *int32 {
	if o == nil {
		return nil
	}

	return o.RetentionTime

}

// GetRetentionTimeOk returns a tuple with the RetentionTime field value
// 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 *TopicLogRetention) GetRetentionTimeOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.RetentionTime, true
}

// SetRetentionTime sets field value
func (o *TopicLogRetention) SetRetentionTime(v int32) {

	o.RetentionTime = &v

}

// HasRetentionTime returns a boolean if a field has been set.
func (o *TopicLogRetention) HasRetentionTime() bool {
	if o != nil && o.RetentionTime != nil {
		return true
	}

	return false
}

// GetSegmentBytes returns the SegmentBytes field value
// If the value is explicit nil, the zero value for int32 will be returned
func (o *TopicLogRetention) GetSegmentBytes() *int32 {
	if o == nil {
		return nil
	}

	return o.SegmentBytes

}

// GetSegmentBytesOk returns a tuple with the SegmentBytes field value
// 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 *TopicLogRetention) GetSegmentBytesOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.SegmentBytes, true
}

// SetSegmentBytes sets field value
func (o *TopicLogRetention) SetSegmentBytes(v int32) {

	o.SegmentBytes = &v

}

// HasSegmentBytes returns a boolean if a field has been set.
func (o *TopicLogRetention) HasSegmentBytes() bool {
	if o != nil && o.SegmentBytes != nil {
		return true
	}

	return false
}

func (o TopicLogRetention) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.RetentionTime != nil {
		toSerialize["retentionTime"] = o.RetentionTime
	}

	if o.SegmentBytes != nil {
		toSerialize["segmentBytes"] = o.SegmentBytes
	}

	return json.Marshal(toSerialize)
}

type NullableTopicLogRetention struct {
	value *TopicLogRetention
	isSet bool
}

func (v NullableTopicLogRetention) Get() *TopicLogRetention {
	return v.value
}

func (v *NullableTopicLogRetention) Set(val *TopicLogRetention) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTopicLogRetention(val *TopicLogRetention) *NullableTopicLogRetention {
	return &NullableTopicLogRetention{value: val, isSet: true}
}

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

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