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

// BlkioStats BlkioStats stores All IO service stats for data read and write.
// swagger:model BlkioStats
type BlkioStats struct {

	// io merged recursive
	IoMergedRecursive []*BlkioStatEntry `json:"io_merged_recursive"`

	// io queue recursive
	IoQueueRecursive []*BlkioStatEntry `json:"io_queue_recursive"`

	// io service bytes recursive
	IoServiceBytesRecursive []*BlkioStatEntry `json:"io_service_bytes_recursive"`

	// io service time recursive
	IoServiceTimeRecursive []*BlkioStatEntry `json:"io_service_time_recursive"`

	// io serviced recursive
	IoServicedRecursive []*BlkioStatEntry `json:"io_serviced_recursive"`

	// io time recursive
	IoTimeRecursive []*BlkioStatEntry `json:"io_time_recursive"`

	// io wait time recursive
	IoWaitTimeRecursive []*BlkioStatEntry `json:"io_wait_time_recursive"`

	// sectors recursive
	SectorsRecursive []*BlkioStatEntry `json:"sectors_recursive"`
}

// Validate validates this blkio stats
func (m *BlkioStats) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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

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

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

func (m *BlkioStats) validateIoMergedRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoMergedRecursive); i++ {
		if swag.IsZero(m.IoMergedRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateIoQueueRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoQueueRecursive); i++ {
		if swag.IsZero(m.IoQueueRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateIoServiceBytesRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoServiceBytesRecursive); i++ {
		if swag.IsZero(m.IoServiceBytesRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateIoServiceTimeRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoServiceTimeRecursive); i++ {
		if swag.IsZero(m.IoServiceTimeRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateIoServicedRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoServicedRecursive); i++ {
		if swag.IsZero(m.IoServicedRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateIoTimeRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoTimeRecursive); i++ {
		if swag.IsZero(m.IoTimeRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateIoWaitTimeRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.IoWaitTimeRecursive); i++ {
		if swag.IsZero(m.IoWaitTimeRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

func (m *BlkioStats) validateSectorsRecursive(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.SectorsRecursive); i++ {
		if swag.IsZero(m.SectorsRecursive[i]) { // not required
			continue
		}

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

	}

	return nil
}

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

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