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

// ClusterHealthResults cluster health results
//
// swagger:model ClusterHealthResults
type ClusterHealthResults struct {

	// o k
	// Required: true
	OK bool `json:"OK"`

	// duration ns
	DurationNs int64 `json:"duration-ns,omitempty"`

	// generated at
	// Format: date-time
	GeneratedAt strfmt.DateTime `json:"generated-at,omitempty"`

	// nodes healthy
	NodesHealthy []string `json:"nodesHealthy"`

	// nodes total
	NodesTotal int64 `json:"nodesTotal,omitempty"`

	// nodes unhealthy
	NodesUnhealthy []string `json:"nodesUnhealthy"`
}

// Validate validates this cluster health results
func (m *ClusterHealthResults) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *ClusterHealthResults) validateOK(formats strfmt.Registry) error {

	if err := validate.Required("OK", "body", bool(m.OK)); err != nil {
		return err
	}

	return nil
}

func (m *ClusterHealthResults) validateGeneratedAt(formats strfmt.Registry) error {
	if swag.IsZero(m.GeneratedAt) { // not required
		return nil
	}

	if err := validate.FormatOf("generated-at", "body", "date-time", m.GeneratedAt.String(), formats); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this cluster health results based on context it is used
func (m *ClusterHealthResults) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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