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

// NetflowEndpoint netflow endpoint
//
// swagger:model NetflowEndpoint
type NetflowEndpoint struct {

	// IP
	// Read Only: true
	IP string `json:"IP,omitempty"`

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

	// dns
	// Read Only: true
	DNS string `json:"dns,omitempty"`

	// last seen
	// Read Only: true
	LastSeen int64 `json:"lastSeen,omitempty"`

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

	// type
	// Read Only: true
	Type string `json:"type,omitempty"`

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

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

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

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

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

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

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

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

	if err := m.contextValidateType(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 *NetflowEndpoint) contextValidateIP(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetflowEndpoint) 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 *NetflowEndpoint) contextValidateDNS(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetflowEndpoint) contextValidateLastSeen(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "lastSeen", "body", int64(m.LastSeen)); err != nil {
		return err
	}

	return nil
}

func (m *NetflowEndpoint) 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 *NetflowEndpoint) contextValidateType(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetflowEndpoint) 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 *NetflowEndpoint) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

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