// 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"
	"encoding/json"

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

// APIMeasurementKind  - UNKNOWN: Unknown (in which case it is not tracked).
//   - COUNTER: Incrementing counters that never decrease (these are not reset on each
//
// reading).
//   - ABSOLUTE: Counters that do get reset upon reading.
//   - GAUGE: E.g. a temperature value.
//   - STRING: E.g. a firmware version, true / false value.
//
// swagger:model apiMeasurementKind
type APIMeasurementKind string

func NewAPIMeasurementKind(value APIMeasurementKind) *APIMeasurementKind {
	return &value
}

// Pointer returns a pointer to a freshly-allocated APIMeasurementKind.
func (m APIMeasurementKind) Pointer() *APIMeasurementKind {
	return &m
}

const (

	// APIMeasurementKindUNKNOWN captures enum value "UNKNOWN"
	APIMeasurementKindUNKNOWN APIMeasurementKind = "UNKNOWN"

	// APIMeasurementKindCOUNTER captures enum value "COUNTER"
	APIMeasurementKindCOUNTER APIMeasurementKind = "COUNTER"

	// APIMeasurementKindABSOLUTE captures enum value "ABSOLUTE"
	APIMeasurementKindABSOLUTE APIMeasurementKind = "ABSOLUTE"

	// APIMeasurementKindGAUGE captures enum value "GAUGE"
	APIMeasurementKindGAUGE APIMeasurementKind = "GAUGE"

	// APIMeasurementKindSTRING captures enum value "STRING"
	APIMeasurementKindSTRING APIMeasurementKind = "STRING"
)

// for schema
var apiMeasurementKindEnum []interface{}

func init() {
	var res []APIMeasurementKind
	if err := json.Unmarshal([]byte(`["UNKNOWN","COUNTER","ABSOLUTE","GAUGE","STRING"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		apiMeasurementKindEnum = append(apiMeasurementKindEnum, v)
	}
}

func (m APIMeasurementKind) validateAPIMeasurementKindEnum(path, location string, value APIMeasurementKind) error {
	if err := validate.EnumCase(path, location, value, apiMeasurementKindEnum, true); err != nil {
		return err
	}
	return nil
}

// Validate validates this api measurement kind
func (m APIMeasurementKind) Validate(formats strfmt.Registry) error {
	var res []error

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

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

// ContextValidate validates this api measurement kind based on context it is used
func (m APIMeasurementKind) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}
