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

// NetflowPort netflow port
//
// swagger:model NetflowPort
type NetflowPort struct {

	// data type
	// Read Only: true
	DataType string `json:"dataType,omitempty"`

	// description
	// Read Only: true
	Description string `json:"description,omitempty"`

	// percent usage
	// Read Only: true
	PercentUsage float64 `json:"percentUsage,omitempty"`

	// port
	// Read Only: true
	Port int32 `json:"port,omitempty"`

	// usage
	// Read Only: true
	Usage float64 `json:"usage,omitempty"`
}

// Validate validates this netflow port
func (m *NetflowPort) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this netflow port based on the context it is used
func (m *NetflowPort) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

func (m *NetflowPort) contextValidateDataType(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "dataType", "body", string(m.DataType)); err != nil {
		return err
	}

	return nil
}

func (m *NetflowPort) contextValidateDescription(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "description", "body", string(m.Description)); err != nil {
		return err
	}

	return nil
}

func (m *NetflowPort) contextValidatePercentUsage(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "percentUsage", "body", float64(m.PercentUsage)); err != nil {
		return err
	}

	return nil
}

func (m *NetflowPort) contextValidatePort(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetflowPort) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "usage", "body", float64(m.Usage)); err != nil {
		return err
	}

	return nil
}

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

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