// 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 (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// CentralConnector central connector
//
// swagger:model centralConnector
type CentralConnector struct {

	// connector id
	// Required: true
	ConnectorID *string `json:"connector_id"`

	// connector type
	// Required: true
	ConnectorType CentralConnectorType `json:"connector_type"`

	// error
	Error string `json:"error,omitempty"`

	// status
	// Required: true
	Status CentralConnectorStatus `json:"status"`

	// topic
	Topic string `json:"topic,omitempty"`

	// url
	// Required: true
	URL *string `json:"url"`

	// user
	User string `json:"user,omitempty"`
}

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

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

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

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

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

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

func (m *CentralConnector) validateConnectorID(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralConnector) validateConnectorType(formats strfmt.Registry) error {

	if err := m.ConnectorType.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("connector_type")
		}
		return err
	}

	return nil
}

func (m *CentralConnector) validateStatus(formats strfmt.Registry) error {

	if err := m.Status.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("status")
		}
		return err
	}

	return nil
}

func (m *CentralConnector) validateURL(formats strfmt.Registry) error {

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

	return nil
}

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

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