// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.21.0

package db

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

type EnumType string

const (
	EnumTypeBeforefirst EnumType = "beforefirst"
	EnumTypeFirst       EnumType = "first"
	EnumTypeSecond      EnumType = "second"
	EnumTypeThird       EnumType = "third"
	EnumTypeFourth      EnumType = "fourth"
	EnumTypeFifth       EnumType = "fifth"
	EnumTypeLast        EnumType = "last"
	EnumTypeAfterlast   EnumType = "afterlast"
)

func (e *EnumType) Scan(src interface{}) error {
	switch s := src.(type) {
	case []byte:
		*e = EnumType(s)
	case string:
		*e = EnumType(s)
	default:
		return fmt.Errorf("unsupported scan type for EnumType: %T", src)
	}
	return nil
}

type NullEnumType struct {
	EnumType EnumType
	Valid    bool // Valid is true if EnumType is not NULL
}

// Scan implements the Scanner interface.
func (ns *NullEnumType) Scan(value interface{}) error {
	if value == nil {
		ns.EnumType, ns.Valid = "", false
		return nil
	}
	ns.Valid = true
	return ns.EnumType.Scan(value)
}

// Value implements the driver Valuer interface.
func (ns NullEnumType) Value() (driver.Value, error) {
	if !ns.Valid {
		return nil, nil
	}
	return string(ns.EnumType), nil
}

func (e EnumType) Valid() bool {
	switch e {
	case EnumTypeBeforefirst,
		EnumTypeFirst,
		EnumTypeSecond,
		EnumTypeThird,
		EnumTypeFourth,
		EnumTypeFifth,
		EnumTypeLast,
		EnumTypeAfterlast:
		return true
	}
	return false
}

func AllEnumTypeValues() []EnumType {
	return []EnumType{
		EnumTypeBeforefirst,
		EnumTypeFirst,
		EnumTypeSecond,
		EnumTypeThird,
		EnumTypeFourth,
		EnumTypeFifth,
		EnumTypeLast,
		EnumTypeAfterlast,
	}
}

type Foo struct {
	ID int32
}
