/*
DM OpenAPI DOC

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

API version: 6.0.0
*/

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

package dm

import (
	"encoding/json"
)

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

// RelayConfig the config of relay
type RelayConfig struct {
	EnableRelay *bool `json:"enable_relay,omitempty"`
	// starting GTID of the upstream binlog
	RelayBinlogGtid NullableString `json:"relay_binlog_gtid,omitempty"`
	// starting filename of the upstream binlog
	RelayBinlogName NullableString `json:"relay_binlog_name,omitempty"`
	// the directory where the relay log is stored
	RelayDir NullableString `json:"relay_dir,omitempty"`
}

// NewRelayConfig instantiates a new RelayConfig 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 NewRelayConfig() *RelayConfig {
	this := RelayConfig{}
	var relayDir string = "./relay_log"
	this.RelayDir = *NewNullableString(&relayDir)
	return &this
}

// NewRelayConfigWithDefaults instantiates a new RelayConfig 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 NewRelayConfigWithDefaults() *RelayConfig {
	this := RelayConfig{}
	var relayDir string = "./relay_log"
	this.RelayDir = *NewNullableString(&relayDir)
	return &this
}

// GetEnableRelay returns the EnableRelay field value if set, zero value otherwise.
func (o *RelayConfig) GetEnableRelay() bool {
	if o == nil || IsNil(o.EnableRelay) {
		var ret bool
		return ret
	}
	return *o.EnableRelay
}

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

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

	return false
}

// SetEnableRelay gets a reference to the given bool and assigns it to the EnableRelay field.
func (o *RelayConfig) SetEnableRelay(v bool) {
	o.EnableRelay = &v
}

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

// GetRelayBinlogGtidOk returns a tuple with the RelayBinlogGtid 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 *RelayConfig) GetRelayBinlogGtidOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.RelayBinlogGtid.Get(), o.RelayBinlogGtid.IsSet()
}

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

	return false
}

// SetRelayBinlogGtid gets a reference to the given NullableString and assigns it to the RelayBinlogGtid field.
func (o *RelayConfig) SetRelayBinlogGtid(v string) {
	o.RelayBinlogGtid.Set(&v)
}

// SetRelayBinlogGtidNil sets the value for RelayBinlogGtid to be an explicit nil
func (o *RelayConfig) SetRelayBinlogGtidNil() {
	o.RelayBinlogGtid.Set(nil)
}

// UnsetRelayBinlogGtid ensures that no value is present for RelayBinlogGtid, not even an explicit nil
func (o *RelayConfig) UnsetRelayBinlogGtid() {
	o.RelayBinlogGtid.Unset()
}

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

// GetRelayBinlogNameOk returns a tuple with the RelayBinlogName 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 *RelayConfig) GetRelayBinlogNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.RelayBinlogName.Get(), o.RelayBinlogName.IsSet()
}

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

	return false
}

// SetRelayBinlogName gets a reference to the given NullableString and assigns it to the RelayBinlogName field.
func (o *RelayConfig) SetRelayBinlogName(v string) {
	o.RelayBinlogName.Set(&v)
}

// SetRelayBinlogNameNil sets the value for RelayBinlogName to be an explicit nil
func (o *RelayConfig) SetRelayBinlogNameNil() {
	o.RelayBinlogName.Set(nil)
}

// UnsetRelayBinlogName ensures that no value is present for RelayBinlogName, not even an explicit nil
func (o *RelayConfig) UnsetRelayBinlogName() {
	o.RelayBinlogName.Unset()
}

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

// GetRelayDirOk returns a tuple with the RelayDir 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 *RelayConfig) GetRelayDirOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.RelayDir.Get(), o.RelayDir.IsSet()
}

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

	return false
}

// SetRelayDir gets a reference to the given NullableString and assigns it to the RelayDir field.
func (o *RelayConfig) SetRelayDir(v string) {
	o.RelayDir.Set(&v)
}

// SetRelayDirNil sets the value for RelayDir to be an explicit nil
func (o *RelayConfig) SetRelayDirNil() {
	o.RelayDir.Set(nil)
}

// UnsetRelayDir ensures that no value is present for RelayDir, not even an explicit nil
func (o *RelayConfig) UnsetRelayDir() {
	o.RelayDir.Unset()
}

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

func (o RelayConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.EnableRelay) {
		toSerialize["enable_relay"] = o.EnableRelay
	}
	if o.RelayBinlogGtid.IsSet() {
		toSerialize["relay_binlog_gtid"] = o.RelayBinlogGtid.Get()
	}
	if o.RelayBinlogName.IsSet() {
		toSerialize["relay_binlog_name"] = o.RelayBinlogName.Get()
	}
	if o.RelayDir.IsSet() {
		toSerialize["relay_dir"] = o.RelayDir.Get()
	}
	return toSerialize, nil
}

type NullableRelayConfig struct {
	value *RelayConfig
	isSet bool
}

func (v NullableRelayConfig) Get() *RelayConfig {
	return v.value
}

func (v *NullableRelayConfig) Set(val *RelayConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRelayConfig(val *RelayConfig) *NullableRelayConfig {
	return &NullableRelayConfig{value: val, isSet: true}
}

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

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