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

// EndpointsPublic Message for public endpoint to connect to the cluster.
type EndpointsPublic struct {
	// The list of networks that are allowed to connect to the cluster.
	AuthorizedNetworks []EndpointsPublicAuthorizedNetwork `json:"authorizedNetworks,omitempty"`
	// Indicates whether the public endpoint is disabled.
	Disabled *bool `json:"disabled,omitempty"`
	// The hostname of the public endpoint.
	Host *string `json:"host,omitempty"`
	Port *int32 `json:"port,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _EndpointsPublic EndpointsPublic

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

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

// GetAuthorizedNetworks returns the AuthorizedNetworks field value if set, zero value otherwise.
func (o *EndpointsPublic) GetAuthorizedNetworks() []EndpointsPublicAuthorizedNetwork {
	if o == nil || IsNil(o.AuthorizedNetworks) {
		var ret []EndpointsPublicAuthorizedNetwork
		return ret
	}
	return o.AuthorizedNetworks
}

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

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

	return false
}

// SetAuthorizedNetworks gets a reference to the given []EndpointsPublicAuthorizedNetwork and assigns it to the AuthorizedNetworks field.
func (o *EndpointsPublic) SetAuthorizedNetworks(v []EndpointsPublicAuthorizedNetwork) {
	o.AuthorizedNetworks = v
}

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

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

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

	return false
}

// SetDisabled gets a reference to the given bool and assigns it to the Disabled field.
func (o *EndpointsPublic) SetDisabled(v bool) {
	o.Disabled = &v
}

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

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

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

	return false
}

// SetHost gets a reference to the given string and assigns it to the Host field.
func (o *EndpointsPublic) SetHost(v string) {
	o.Host = &v
}

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

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

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

	return false
}

// SetPort gets a reference to the given int32 and assigns it to the Port field.
func (o *EndpointsPublic) SetPort(v int32) {
	o.Port = &v
}

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

func (o EndpointsPublic) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.AuthorizedNetworks) {
		toSerialize["authorizedNetworks"] = o.AuthorizedNetworks
	}
	if !IsNil(o.Disabled) {
		toSerialize["disabled"] = o.Disabled
	}
	if !IsNil(o.Host) {
		toSerialize["host"] = o.Host
	}
	if !IsNil(o.Port) {
		toSerialize["port"] = o.Port
	}

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

	return toSerialize, nil
}

func (o *EndpointsPublic) UnmarshalJSON(data []byte) (err error) {
	varEndpointsPublic := _EndpointsPublic{}

	err = json.Unmarshal(data, &varEndpointsPublic)

	if err != nil {
		return err
	}

	*o = EndpointsPublic(varEndpointsPublic)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "authorizedNetworks")
		delete(additionalProperties, "disabled")
		delete(additionalProperties, "host")
		delete(additionalProperties, "port")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableEndpointsPublic struct {
	value *EndpointsPublic
	isSet bool
}

func (v NullableEndpointsPublic) Get() *EndpointsPublic {
	return v.value
}

func (v *NullableEndpointsPublic) Set(val *EndpointsPublic) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableEndpointsPublic(val *EndpointsPublic) *NullableEndpointsPublic {
	return &NullableEndpointsPublic{value: val, isSet: true}
}

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

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


