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

// MemoryMethod memory method
//
// swagger:model memory_method
type MemoryMethod string

func NewMemoryMethod(value MemoryMethod) *MemoryMethod {
	return &value
}

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

const (

	// MemoryMethodDmidecode captures enum value "dmidecode"
	MemoryMethodDmidecode MemoryMethod = "dmidecode"

	// MemoryMethodGhw captures enum value "ghw"
	MemoryMethodGhw MemoryMethod = "ghw"

	// MemoryMethodMeminfo captures enum value "meminfo"
	MemoryMethodMeminfo MemoryMethod = "meminfo"
)

// for schema
var memoryMethodEnum []interface{}

func init() {
	var res []MemoryMethod
	if err := json.Unmarshal([]byte(`["dmidecode","ghw","meminfo"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		memoryMethodEnum = append(memoryMethodEnum, v)
	}
}

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

// Validate validates this memory method
func (m MemoryMethod) Validate(formats strfmt.Registry) error {
	var res []error

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

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

// ContextValidate validates this memory method based on context it is used
func (m MemoryMethod) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}
