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

package models

// 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"
)

// CentralEndpoint central endpoint
//
// swagger:model centralEndpoint
type CentralEndpoint struct {

	// address
	// Required: true
	Address *string `json:"address"`

	// port
	// Required: true
	Port *int32 `json:"port"`

	// ready
	// Required: true
	Ready *bool `json:"ready"`

	// token
	Token string `json:"token,omitempty"`
}

// Validate validates this central endpoint
func (m *CentralEndpoint) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *CentralEndpoint) validateAddress(formats strfmt.Registry) error {

	if err := validate.Required("address", "body", m.Address); err != nil {
		return err
	}

	return nil
}

func (m *CentralEndpoint) validatePort(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralEndpoint) validateReady(formats strfmt.Registry) error {

	if err := validate.Required("ready", "body", m.Ready); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this central endpoint based on context it is used
func (m *CentralEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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