// Code generated by go-enum DO NOT EDIT.
// Version: 0.5.8
// Revision: 3d844c8ecc59661ed7aa17bfd65727bc06a60ad8
// Build Date: 2023-09-18T14:55:21Z
// Built By: goreleaser

package chat

import (
	"fmt"
	"strings"
)

const (
	// ExportTypeTime is a ExportType of type Time.
	ExportTypeTime ExportType = iota
	// ExportTypeId is a ExportType of type Id.
	ExportTypeId
	// ExportTypeLast is a ExportType of type Last.
	ExportTypeLast
)

var ErrInvalidExportType = fmt.Errorf("not a valid ExportType, try [%s]", strings.Join(_ExportTypeNames, ", "))

const _ExportTypeName = "timeidlast"

var _ExportTypeNames = []string{
	_ExportTypeName[0:4],
	_ExportTypeName[4:6],
	_ExportTypeName[6:10],
}

// ExportTypeNames returns a list of possible string values of ExportType.
func ExportTypeNames() []string {
	tmp := make([]string, len(_ExportTypeNames))
	copy(tmp, _ExportTypeNames)
	return tmp
}

// ExportTypeValues returns a list of the values for ExportType
func ExportTypeValues() []ExportType {
	return []ExportType{
		ExportTypeTime,
		ExportTypeId,
		ExportTypeLast,
	}
}

var _ExportTypeMap = map[ExportType]string{
	ExportTypeTime: _ExportTypeName[0:4],
	ExportTypeId:   _ExportTypeName[4:6],
	ExportTypeLast: _ExportTypeName[6:10],
}

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

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

var _ExportTypeValue = map[string]ExportType{
	_ExportTypeName[0:4]:                   ExportTypeTime,
	strings.ToLower(_ExportTypeName[0:4]):  ExportTypeTime,
	_ExportTypeName[4:6]:                   ExportTypeId,
	strings.ToLower(_ExportTypeName[4:6]):  ExportTypeId,
	_ExportTypeName[6:10]:                  ExportTypeLast,
	strings.ToLower(_ExportTypeName[6:10]): ExportTypeLast,
}

// ParseExportType attempts to convert a string to a ExportType.
func ParseExportType(name string) (ExportType, error) {
	if x, ok := _ExportTypeValue[name]; ok {
		return x, nil
	}
	// Case insensitive parse, do a separate lookup to prevent unnecessary cost of lowercasing a string if we don't need to.
	if x, ok := _ExportTypeValue[strings.ToLower(name)]; ok {
		return x, nil
	}
	return ExportType(0), fmt.Errorf("%s is %w", name, ErrInvalidExportType)
}

// Set implements the Golang flag.Value interface func.
func (x *ExportType) Set(val string) error {
	v, err := ParseExportType(val)
	*x = v
	return err
}

// Get implements the Golang flag.Getter interface func.
func (x *ExportType) Get() interface{} {
	return *x
}

// Type implements the github.com/spf13/pFlag Value interface.
func (x *ExportType) Type() string {
	return "ExportType"
}
