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

// APIEmailConfiguration Api email configuration
//
// swagger:model ApiEmailConfiguration
type APIEmailConfiguration struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`

	// from address
	// Example: nexus@example.org
	FromAddress string `json:"fromAddress,omitempty"`

	// host
	Host string `json:"host,omitempty"`

	// Use the Nexus Repository Manager's certificate truststore
	NexusTrustStoreEnabled bool `json:"nexusTrustStoreEnabled,omitempty"`

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

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

	// Enable SSL/TLS Encryption upon Connection
	SslOnConnectEnabled bool `json:"sslOnConnectEnabled,omitempty"`

	// Verify the server certificate when using TLS or SSL
	SslServerIdentityCheckEnabled bool `json:"sslServerIdentityCheckEnabled,omitempty"`

	// Enable STARTTLS Support for Insecure Connections
	StartTLSEnabled bool `json:"startTlsEnabled,omitempty"`

	// Require STARTTLS Support
	StartTLSRequired bool `json:"startTlsRequired,omitempty"`

	// A prefix to add to all email subjects to aid in identifying automated emails
	SubjectPrefix string `json:"subjectPrefix,omitempty"`

	// username
	Username string `json:"username,omitempty"`
}

// Validate validates this Api email configuration
func (m *APIEmailConfiguration) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

	return nil
}

// ContextValidate validates this Api email configuration based on context it is used
func (m *APIEmailConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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