// Code generated by go-swagger; DO NOT EDIT.

// Copyright Authors of Cilium
// SPDX-License-Identifier: Apache-2.0

package models

import (
	"context"
	"encoding/json"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// HubbleMetricsStatus Status of the Hubble metrics server
//
// +k8s:deepcopy-gen=true
//
// swagger:model HubbleMetricsStatus
type HubbleMetricsStatus struct {

	// Human readable status/error/warning message
	Msg string `json:"msg,omitempty"`

	// State the component is in
	// Enum: ["Ok","Warning","Failure","Disabled"]
	State string `json:"state,omitempty"`
}

// Validate validates this hubble metrics status
func (m *HubbleMetricsStatus) Validate(formats strfmt.Registry) error {
	var res []error

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

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

var hubbleMetricsStatusTypeStatePropEnum []any

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["Ok","Warning","Failure","Disabled"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		hubbleMetricsStatusTypeStatePropEnum = append(hubbleMetricsStatusTypeStatePropEnum, v)
	}
}

const (

	// HubbleMetricsStatusStateOk captures enum value "Ok"
	HubbleMetricsStatusStateOk string = "Ok"

	// HubbleMetricsStatusStateWarning captures enum value "Warning"
	HubbleMetricsStatusStateWarning string = "Warning"

	// HubbleMetricsStatusStateFailure captures enum value "Failure"
	HubbleMetricsStatusStateFailure string = "Failure"

	// HubbleMetricsStatusStateDisabled captures enum value "Disabled"
	HubbleMetricsStatusStateDisabled string = "Disabled"
)

// prop value enum
func (m *HubbleMetricsStatus) validateStateEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, hubbleMetricsStatusTypeStatePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *HubbleMetricsStatus) validateState(formats strfmt.Registry) error {
	if swag.IsZero(m.State) { // not required
		return nil
	}

	// value enum
	if err := m.validateStateEnum("state", "body", m.State); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this hubble metrics status based on context it is used
func (m *HubbleMetricsStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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