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

package consts

import (
	"database/sql/driver"
	"errors"
	"fmt"
	"strings"
)

const (
	// TenantInviteStatusActive is a TenantInviteStatus of type active.
	TenantInviteStatusActive TenantInviteStatus = "active"
	// TenantInviteStatusDisabled is a TenantInviteStatus of type disabled.
	TenantInviteStatusDisabled TenantInviteStatus = "disabled"
	// TenantInviteStatusExpired is a TenantInviteStatus of type expired.
	TenantInviteStatusExpired TenantInviteStatus = "expired"
)

var ErrInvalidTenantInviteStatus = fmt.Errorf("not a valid TenantInviteStatus, try [%s]", strings.Join(_TenantInviteStatusNames, ", "))

var _TenantInviteStatusNames = []string{
	string(TenantInviteStatusActive),
	string(TenantInviteStatusDisabled),
	string(TenantInviteStatusExpired),
}

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

// TenantInviteStatusValues returns a list of the values for TenantInviteStatus
func TenantInviteStatusValues() []TenantInviteStatus {
	return []TenantInviteStatus{
		TenantInviteStatusActive,
		TenantInviteStatusDisabled,
		TenantInviteStatusExpired,
	}
}

// String implements the Stringer interface.
func (x TenantInviteStatus) String() string {
	return string(x)
}

// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x TenantInviteStatus) IsValid() bool {
	_, err := ParseTenantInviteStatus(string(x))
	return err == nil
}

var _TenantInviteStatusValue = map[string]TenantInviteStatus{
	"active":   TenantInviteStatusActive,
	"disabled": TenantInviteStatusDisabled,
	"expired":  TenantInviteStatusExpired,
}

// ParseTenantInviteStatus attempts to convert a string to a TenantInviteStatus.
func ParseTenantInviteStatus(name string) (TenantInviteStatus, error) {
	if x, ok := _TenantInviteStatusValue[name]; ok {
		return x, nil
	}
	return TenantInviteStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantInviteStatus)
}

var errTenantInviteStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes

// Scan implements the Scanner interface.
func (x *TenantInviteStatus) Scan(value interface{}) (err error) {
	if value == nil {
		*x = TenantInviteStatus("")
		return
	}

	// A wider range of scannable types.
	// driver.Value values at the top of the list for expediency
	switch v := value.(type) {
	case string:
		*x, err = ParseTenantInviteStatus(v)
	case []byte:
		*x, err = ParseTenantInviteStatus(string(v))
	case TenantInviteStatus:
		*x = v
	case *TenantInviteStatus:
		if v == nil {
			return errTenantInviteStatusNilPtr
		}
		*x = *v
	case *string:
		if v == nil {
			return errTenantInviteStatusNilPtr
		}
		*x, err = ParseTenantInviteStatus(*v)
	default:
		return errors.New("invalid type for TenantInviteStatus")
	}

	return
}

// Value implements the driver Valuer interface.
func (x TenantInviteStatus) Value() (driver.Value, error) {
	return x.String(), nil
}

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

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

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

type NullTenantInviteStatus struct {
	TenantInviteStatus TenantInviteStatus
	Valid              bool
}

func NewNullTenantInviteStatus(val interface{}) (x NullTenantInviteStatus) {
	err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
	_ = err            // make any errcheck linters happy
	return
}

// Scan implements the Scanner interface.
func (x *NullTenantInviteStatus) Scan(value interface{}) (err error) {
	if value == nil {
		x.TenantInviteStatus, x.Valid = TenantInviteStatus(""), false
		return
	}

	err = x.TenantInviteStatus.Scan(value)
	x.Valid = (err == nil)
	return
}

// Value implements the driver Valuer interface.
func (x NullTenantInviteStatus) Value() (driver.Value, error) {
	if !x.Valid {
		return nil, nil
	}
	// driver.Value accepts int64 for int values.
	return string(x.TenantInviteStatus), nil
}

type NullTenantInviteStatusStr struct {
	NullTenantInviteStatus
}

func NewNullTenantInviteStatusStr(val interface{}) (x NullTenantInviteStatusStr) {
	x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
	return
}

// Value implements the driver Valuer interface.
func (x NullTenantInviteStatusStr) Value() (driver.Value, error) {
	if !x.Valid {
		return nil, nil
	}
	return x.TenantInviteStatus.String(), nil
}

const (
	// TenantJoinRequestStatusPending is a TenantJoinRequestStatus of type pending.
	TenantJoinRequestStatusPending TenantJoinRequestStatus = "pending"
	// TenantJoinRequestStatusApproved is a TenantJoinRequestStatus of type approved.
	TenantJoinRequestStatusApproved TenantJoinRequestStatus = "approved"
	// TenantJoinRequestStatusRejected is a TenantJoinRequestStatus of type rejected.
	TenantJoinRequestStatusRejected TenantJoinRequestStatus = "rejected"
)

var ErrInvalidTenantJoinRequestStatus = fmt.Errorf("not a valid TenantJoinRequestStatus, try [%s]", strings.Join(_TenantJoinRequestStatusNames, ", "))

var _TenantJoinRequestStatusNames = []string{
	string(TenantJoinRequestStatusPending),
	string(TenantJoinRequestStatusApproved),
	string(TenantJoinRequestStatusRejected),
}

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

// TenantJoinRequestStatusValues returns a list of the values for TenantJoinRequestStatus
func TenantJoinRequestStatusValues() []TenantJoinRequestStatus {
	return []TenantJoinRequestStatus{
		TenantJoinRequestStatusPending,
		TenantJoinRequestStatusApproved,
		TenantJoinRequestStatusRejected,
	}
}

// String implements the Stringer interface.
func (x TenantJoinRequestStatus) String() string {
	return string(x)
}

// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x TenantJoinRequestStatus) IsValid() bool {
	_, err := ParseTenantJoinRequestStatus(string(x))
	return err == nil
}

var _TenantJoinRequestStatusValue = map[string]TenantJoinRequestStatus{
	"pending":  TenantJoinRequestStatusPending,
	"approved": TenantJoinRequestStatusApproved,
	"rejected": TenantJoinRequestStatusRejected,
}

// ParseTenantJoinRequestStatus attempts to convert a string to a TenantJoinRequestStatus.
func ParseTenantJoinRequestStatus(name string) (TenantJoinRequestStatus, error) {
	if x, ok := _TenantJoinRequestStatusValue[name]; ok {
		return x, nil
	}
	return TenantJoinRequestStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantJoinRequestStatus)
}

var errTenantJoinRequestStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes

// Scan implements the Scanner interface.
func (x *TenantJoinRequestStatus) Scan(value interface{}) (err error) {
	if value == nil {
		*x = TenantJoinRequestStatus("")
		return
	}

	// A wider range of scannable types.
	// driver.Value values at the top of the list for expediency
	switch v := value.(type) {
	case string:
		*x, err = ParseTenantJoinRequestStatus(v)
	case []byte:
		*x, err = ParseTenantJoinRequestStatus(string(v))
	case TenantJoinRequestStatus:
		*x = v
	case *TenantJoinRequestStatus:
		if v == nil {
			return errTenantJoinRequestStatusNilPtr
		}
		*x = *v
	case *string:
		if v == nil {
			return errTenantJoinRequestStatusNilPtr
		}
		*x, err = ParseTenantJoinRequestStatus(*v)
	default:
		return errors.New("invalid type for TenantJoinRequestStatus")
	}

	return
}

// Value implements the driver Valuer interface.
func (x TenantJoinRequestStatus) Value() (driver.Value, error) {
	return x.String(), nil
}

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

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

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

type NullTenantJoinRequestStatus struct {
	TenantJoinRequestStatus TenantJoinRequestStatus
	Valid                   bool
}

func NewNullTenantJoinRequestStatus(val interface{}) (x NullTenantJoinRequestStatus) {
	err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
	_ = err            // make any errcheck linters happy
	return
}

// Scan implements the Scanner interface.
func (x *NullTenantJoinRequestStatus) Scan(value interface{}) (err error) {
	if value == nil {
		x.TenantJoinRequestStatus, x.Valid = TenantJoinRequestStatus(""), false
		return
	}

	err = x.TenantJoinRequestStatus.Scan(value)
	x.Valid = (err == nil)
	return
}

// Value implements the driver Valuer interface.
func (x NullTenantJoinRequestStatus) Value() (driver.Value, error) {
	if !x.Valid {
		return nil, nil
	}
	// driver.Value accepts int64 for int values.
	return string(x.TenantJoinRequestStatus), nil
}

type NullTenantJoinRequestStatusStr struct {
	NullTenantJoinRequestStatus
}

func NewNullTenantJoinRequestStatusStr(val interface{}) (x NullTenantJoinRequestStatusStr) {
	x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
	return
}

// Value implements the driver Valuer interface.
func (x NullTenantJoinRequestStatusStr) Value() (driver.Value, error) {
	if !x.Valid {
		return nil, nil
	}
	return x.TenantJoinRequestStatus.String(), nil
}
