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

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

// OrderDir order dir
//
// swagger:model orderDir
type OrderDir string

func NewOrderDir(value OrderDir) *OrderDir {
	return &value
}

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

const (

	// OrderDirAsc captures enum value "asc"
	OrderDirAsc OrderDir = "asc"

	// OrderDirDesc captures enum value "desc"
	OrderDirDesc OrderDir = "desc"
)

// for schema
var orderDirEnum []interface{}

func init() {
	var res []OrderDir
	if err := json.Unmarshal([]byte(`["asc","desc"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		orderDirEnum = append(orderDirEnum, v)
	}
}

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

// Validate validates this order dir
func (m OrderDir) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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