/*
TiDB Cloud Console API

TiDB Cloud Console API.

API version: v1beta1
*/

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

package client

import (
	"encoding/json"
)

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

// V1beta1ClusterEndpoints Message for endpoint information for connecting to a cluster.
type V1beta1ClusterEndpoints struct {
	// The private endpoint for securely connecting to the cluster. For more information, see [Network](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster-serverless/#network).
	Private *EndpointsPrivate `json:"private,omitempty"`
	// The public endpoint configuration for connecting to the cluster. For more information, see [Network](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster-serverless/#network).
	Public *EndpointsPublic `json:"public,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _V1beta1ClusterEndpoints V1beta1ClusterEndpoints

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

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

// GetPrivate returns the Private field value if set, zero value otherwise.
func (o *V1beta1ClusterEndpoints) GetPrivate() EndpointsPrivate {
	if o == nil || IsNil(o.Private) {
		var ret EndpointsPrivate
		return ret
	}
	return *o.Private
}

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

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

	return false
}

// SetPrivate gets a reference to the given EndpointsPrivate and assigns it to the Private field.
func (o *V1beta1ClusterEndpoints) SetPrivate(v EndpointsPrivate) {
	o.Private = &v
}

// GetPublic returns the Public field value if set, zero value otherwise.
func (o *V1beta1ClusterEndpoints) GetPublic() EndpointsPublic {
	if o == nil || IsNil(o.Public) {
		var ret EndpointsPublic
		return ret
	}
	return *o.Public
}

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

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

	return false
}

// SetPublic gets a reference to the given EndpointsPublic and assigns it to the Public field.
func (o *V1beta1ClusterEndpoints) SetPublic(v EndpointsPublic) {
	o.Public = &v
}

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

func (o V1beta1ClusterEndpoints) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Private) {
		toSerialize["private"] = o.Private
	}
	if !IsNil(o.Public) {
		toSerialize["public"] = o.Public
	}

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

	return toSerialize, nil
}

func (o *V1beta1ClusterEndpoints) UnmarshalJSON(data []byte) (err error) {
	varV1beta1ClusterEndpoints := _V1beta1ClusterEndpoints{}

	err = json.Unmarshal(data, &varV1beta1ClusterEndpoints)

	if err != nil {
		return err
	}

	*o = V1beta1ClusterEndpoints(varV1beta1ClusterEndpoints)

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

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

	return err
}

type NullableV1beta1ClusterEndpoints struct {
	value *V1beta1ClusterEndpoints
	isSet bool
}

func (v NullableV1beta1ClusterEndpoints) Get() *V1beta1ClusterEndpoints {
	return v.value
}

func (v *NullableV1beta1ClusterEndpoints) Set(val *V1beta1ClusterEndpoints) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableV1beta1ClusterEndpoints(val *V1beta1ClusterEndpoints) *NullableV1beta1ClusterEndpoints {
	return &NullableV1beta1ClusterEndpoints{value: val, isSet: true}
}

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

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


