package token

// GrantType represents OAuth 2.0 grant types
type GrantType string

// ToString returns the string representation of GrantType
func (g GrantType) ToString() string {
	return string(g)
}

// IsValid returns true if the grant type is valid
func (g GrantType) IsValid() bool {
	switch g {
	case PasswordCredentials, ClientCredentials, Refreshing:
		return true
	default:
		return false
	}
}

const (
	PasswordCredentials GrantType = "password"
	ClientCredentials   GrantType = "client_credentials"
	Refreshing          GrantType = "refresh_token"
)
