// Code generated by go-enum DO NOT EDIT.
// Version: example
// Revision: example
// Build Date: example
// Built By: example

//go:build example
// +build example

package globs

import (
	"errors"
	"fmt"
)

const (
	// LetterA is a Letter of type A.
	LetterA Letter = iota
	// LetterB is a Letter of type B.
	LetterB
	// LetterC is a Letter of type C.
	LetterC
	// LetterD is a Letter of type D.
	LetterD
	// LetterE is a Letter of type E.
	LetterE
	// LetterF is a Letter of type F.
	LetterF
	// LetterG is a Letter of type G.
	LetterG
	// LetterH is a Letter of type H.
	LetterH
	// LetterI is a Letter of type I.
	LetterI
	// LetterJ is a Letter of type J.
	LetterJ
	// LetterK is a Letter of type K.
	LetterK
	// LetterL is a Letter of type L.
	LetterL
	// LetterM is a Letter of type M.
	LetterM
	// LetterN is a Letter of type N.
	LetterN
	// LetterO is a Letter of type O.
	LetterO
	// LetterP is a Letter of type P.
	LetterP
	// LetterQ is a Letter of type Q.
	LetterQ
	// LetterR is a Letter of type R.
	LetterR
	// LetterS is a Letter of type S.
	LetterS
	// LetterT is a Letter of type T.
	LetterT
	// LetterU is a Letter of type U.
	LetterU
	// LetterV is a Letter of type V.
	LetterV
	// LetterW is a Letter of type W.
	LetterW
	// LetterX is a Letter of type X.
	LetterX
	// LetterY is a Letter of type Y.
	LetterY
	// LetterZ is a Letter of type Z.
	LetterZ
)

var ErrInvalidLetter = errors.New("not a valid Letter")

const _LetterName = "abcdefghijklmnopqrstuvwxyz"

var _LetterMap = map[Letter]string{
	LetterA: _LetterName[0:1],
	LetterB: _LetterName[1:2],
	LetterC: _LetterName[2:3],
	LetterD: _LetterName[3:4],
	LetterE: _LetterName[4:5],
	LetterF: _LetterName[5:6],
	LetterG: _LetterName[6:7],
	LetterH: _LetterName[7:8],
	LetterI: _LetterName[8:9],
	LetterJ: _LetterName[9:10],
	LetterK: _LetterName[10:11],
	LetterL: _LetterName[11:12],
	LetterM: _LetterName[12:13],
	LetterN: _LetterName[13:14],
	LetterO: _LetterName[14:15],
	LetterP: _LetterName[15:16],
	LetterQ: _LetterName[16:17],
	LetterR: _LetterName[17:18],
	LetterS: _LetterName[18:19],
	LetterT: _LetterName[19:20],
	LetterU: _LetterName[20:21],
	LetterV: _LetterName[21:22],
	LetterW: _LetterName[22:23],
	LetterX: _LetterName[23:24],
	LetterY: _LetterName[24:25],
	LetterZ: _LetterName[25:26],
}

// String implements the Stringer interface.
func (x Letter) String() string {
	if str, ok := _LetterMap[x]; ok {
		return str
	}
	return fmt.Sprintf("Letter(%d)", x)
}

// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x Letter) IsValid() bool {
	_, ok := _LetterMap[x]
	return ok
}

var _LetterValue = map[string]Letter{
	_LetterName[0:1]:   LetterA,
	_LetterName[1:2]:   LetterB,
	_LetterName[2:3]:   LetterC,
	_LetterName[3:4]:   LetterD,
	_LetterName[4:5]:   LetterE,
	_LetterName[5:6]:   LetterF,
	_LetterName[6:7]:   LetterG,
	_LetterName[7:8]:   LetterH,
	_LetterName[8:9]:   LetterI,
	_LetterName[9:10]:  LetterJ,
	_LetterName[10:11]: LetterK,
	_LetterName[11:12]: LetterL,
	_LetterName[12:13]: LetterM,
	_LetterName[13:14]: LetterN,
	_LetterName[14:15]: LetterO,
	_LetterName[15:16]: LetterP,
	_LetterName[16:17]: LetterQ,
	_LetterName[17:18]: LetterR,
	_LetterName[18:19]: LetterS,
	_LetterName[19:20]: LetterT,
	_LetterName[20:21]: LetterU,
	_LetterName[21:22]: LetterV,
	_LetterName[22:23]: LetterW,
	_LetterName[23:24]: LetterX,
	_LetterName[24:25]: LetterY,
	_LetterName[25:26]: LetterZ,
}

// ParseLetter attempts to convert a string to a Letter.
func ParseLetter(name string) (Letter, error) {
	if x, ok := _LetterValue[name]; ok {
		return x, nil
	}
	return Letter(0), fmt.Errorf("%s is %w", name, ErrInvalidLetter)
}
