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

// CentralConnectorCreateReq central connector create req
//
// swagger:model centralConnectorCreateReq
type CentralConnectorCreateReq struct {

	// cluster id
	// Required: true
	ClusterID *string `json:"cluster_id"`

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

	// ignore replication
	IgnoreReplication bool `json:"ignore_replication,omitempty"`

	// org id
	// Required: true
	OrgID *string `json:"org_id"`

	// password
	Password string `json:"password,omitempty"`

	// project id
	// Required: true
	ProjectID *string `json:"project_id"`

	// start tso
	StartTso string `json:"start_tso,omitempty"`

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

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

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

	//downstream options
	KafkaInfo *DataflowKafkaInfo `json:"kafka_info,omitempty"`
	//DownstreamOptions *DownstreamOptions `json:"downstream_options,omitempty"`
}

//type DownstreamOptions interface {
//
//}
//
//const (
//
//	// CentralConnectorTypeTOTAL captures enum value "TOTAL"
//	DownstreamOptionsTOTAL CentralConnectorType = ""
//
//	// CentralConnectorTypeKAFKA captures enum value "KAFKA"
//	DownstreamOptionsKAFKA CentralConnectorType = *DataflowKafkaInfo
//
//	// CentralConnectorTypeMYSQL captures enum value "MYSQL"
//	DownstreamOptionsMYSQL CentralConnectorType = ""
//)

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

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

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

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

	if err := m.validateProjectID(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 *CentralConnectorCreateReq) validateClusterID(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralConnectorCreateReq) 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 *CentralConnectorCreateReq) validateOrgID(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralConnectorCreateReq) validateProjectID(formats strfmt.Registry) error {

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

	return nil
}

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

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

	return nil
}

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

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