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

package types

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

// EndpointSettings Configuration for a network endpoint.
// swagger:model EndpointSettings
type EndpointSettings struct {

	// aliases
	Aliases []string `json:"Aliases"`

	// DriverOpts is a mapping of driver options and values. These options
	// are passed directly to the driver and are driver specific.
	//
	DriverOpts map[string]string `json:"DriverOpts,omitempty"`

	// Unique ID for the service endpoint in a Sandbox.
	//
	EndpointID string `json:"EndpointID,omitempty"`

	// Gateway address for this network.
	//
	Gateway string `json:"Gateway,omitempty"`

	// Global IPv6 address.
	//
	GlobalIPV6Address string `json:"GlobalIPv6Address,omitempty"`

	// Mask length of the global IPv6 address.
	//
	GlobalIPV6PrefixLen int64 `json:"GlobalIPv6PrefixLen,omitempty"`

	// IP a m config
	IPAMConfig *EndpointIPAMConfig `json:"IPAMConfig,omitempty"`

	// IPv4 address.
	//
	IPAddress string `json:"IPAddress,omitempty"`

	// Mask length of the IPv4 address.
	//
	IPPrefixLen int64 `json:"IPPrefixLen,omitempty"`

	// IPv6 gateway address.
	//
	IPV6Gateway string `json:"IPv6Gateway,omitempty"`

	// links
	Links []string `json:"Links"`

	// MAC address for the endpoint on this network.
	//
	MacAddress string `json:"MacAddress,omitempty"`

	// Unique ID of the network.
	//
	NetworkID string `json:"NetworkID,omitempty"`
}

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

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

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

func (m *EndpointSettings) validateIPAMConfig(formats strfmt.Registry) error {

	if swag.IsZero(m.IPAMConfig) { // not required
		return nil
	}

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

	return nil
}

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

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