// 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 (
	"strconv"

	"github.com/go-openapi/errors"
	strfmt "github.com/go-openapi/strfmt"
	"github.com/go-openapi/validate"
)

// PortMap PortMap describes the mapping of container ports to host ports, using the
// container's port-number and protocol as key in the format `<port>/<protocol>`,
// for example, `80/udp`.
//
// If a container's port is mapped for both `tcp` and `udp`, two separate
// entries are added to the mapping table.
//
// swagger:model PortMap
type PortMap map[string][]PortBinding

// Validate validates this port map
func (m PortMap) Validate(formats strfmt.Registry) error {
	var res []error

	for k := range m {

		if err := validate.Required(k, "body", m[k]); err != nil {
			return err
		}

		for i := 0; i < len(m[k]); i++ {

			if err := m[k][i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName(k + "." + strconv.Itoa(i))
				}
				return err
			}

		}

	}

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