// Code generated by go-swagger; DO NOT EDIT.

package model

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// EndpointsPublic Message for public endpoint to connect to the cluster.
//
// swagger:model EndpointsPublic
type EndpointsPublic struct {

	// Optional. Whether the public endpoint is disabled.
	Disabled bool `json:"disabled,omitempty"`

	// Output_only. The hostname of the public endpoint.
	// Read Only: true
	Host string `json:"host,omitempty"`

	// Output_only. The port of the public endpoint.
	// Read Only: true
	Port int32 `json:"port,omitempty"`
}

// Validate validates this endpoints public
func (m *EndpointsPublic) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this endpoints public based on the context it is used
func (m *EndpointsPublic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := m.contextValidateHost(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidatePort(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *EndpointsPublic) contextValidateHost(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "host", "body", string(m.Host)); err != nil {
		return err
	}

	return nil
}

func (m *EndpointsPublic) contextValidatePort(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "port", "body", int32(m.Port)); err != nil {
		return err
	}

	return nil
}

// MarshalBinary interface implementation
func (m *EndpointsPublic) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *EndpointsPublic) UnmarshalBinary(b []byte) error {
	var res EndpointsPublic
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
