//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//

package model

import "errors"

type Permissionaccess string

const (
	Permissionaccess_Denied     Permissionaccess = "denied"
	Permissionaccess_Granted    Permissionaccess = "granted"
	Permissionaccess_Unselected Permissionaccess = "unselected"
	Permissionaccess_WithOwner  Permissionaccess = "with-owner"
)

var PermissionaccessAllValues = []Permissionaccess{
	Permissionaccess_Denied,
	Permissionaccess_Granted,
	Permissionaccess_Unselected,
	Permissionaccess_WithOwner,
}

func (e *Permissionaccess) Scan(value interface{}) error {
	var enumValue string
	switch val := value.(type) {
	case string:
		enumValue = val
	case []byte:
		enumValue = string(val)
	default:
		return errors.New("jet: Invalid scan value for AllTypesEnum enum. Enum value has to be of type string or []byte")
	}

	switch enumValue {
	case "denied":
		*e = Permissionaccess_Denied
	case "granted":
		*e = Permissionaccess_Granted
	case "unselected":
		*e = Permissionaccess_Unselected
	case "with-owner":
		*e = Permissionaccess_WithOwner
	default:
		return errors.New("jet: Invalid scan value '" + enumValue + "' for Permissionaccess enum")
	}

	return nil
}

func (e Permissionaccess) String() string {
	return string(e)
}
