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

// NetFlowRecord net flow record
//
// swagger:model NetFlowRecord
type NetFlowRecord struct {

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

	// destination m bytes
	// Read Only: true
	DestinationMBytes float64 `json:"destinationMBytes,omitempty"`

	// dst DNS
	// Read Only: true
	DstDNS string `json:"dstDNS,omitempty"`

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

	// dst port
	// Read Only: true
	DstPort int32 `json:"dstPort,omitempty"`

	// first epoch in sec
	// Read Only: true
	FirstEpochInSec int64 `json:"firstEpochInSec,omitempty"`

	// if in
	// Read Only: true
	IfIn int64 `json:"ifIn,omitempty"`

	// if out
	// Read Only: true
	IfOut int64 `json:"ifOut,omitempty"`

	// last epoch in sec
	// Read Only: true
	LastEpochInSec int64 `json:"lastEpochInSec,omitempty"`

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

	// protocol
	// Read Only: true
	Protocol string `json:"protocol,omitempty"`

	// source m bytes
	// Read Only: true
	SourceMBytes float64 `json:"sourceMBytes,omitempty"`

	// src DNS
	// Read Only: true
	SrcDNS string `json:"srcDNS,omitempty"`

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

	// src port
	// Read Only: true
	SrcPort int32 `json:"srcPort,omitempty"`

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

// Validate validates this net flow record
func (m *NetFlowRecord) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this net flow record based on the context it is used
func (m *NetFlowRecord) 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.contextValidateDestinationMBytes(ctx, formats); err != nil {
		res = append(res, err)
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return nil
}

func (m *NetFlowRecord) contextValidateDstDNS(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateDstIP(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateDstPort(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateFirstEpochInSec(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateIfIn(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateIfOut(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateLastEpochInSec(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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

	return nil
}

func (m *NetFlowRecord) contextValidateSourceMBytes(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateSrcDNS(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateSrcIP(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *NetFlowRecord) contextValidateSrcPort(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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