//
// 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 Mappingdestinationaddress string

const (
	Mappingdestinationaddress_Country    Mappingdestinationaddress = "country"
	Mappingdestinationaddress_Locality   Mappingdestinationaddress = "locality"
	Mappingdestinationaddress_PostalCode Mappingdestinationaddress = "postal_code"
	Mappingdestinationaddress_Street     Mappingdestinationaddress = "street"
	Mappingdestinationaddress_Unit       Mappingdestinationaddress = "unit"
)

var MappingdestinationaddressAllValues = []Mappingdestinationaddress{
	Mappingdestinationaddress_Country,
	Mappingdestinationaddress_Locality,
	Mappingdestinationaddress_PostalCode,
	Mappingdestinationaddress_Street,
	Mappingdestinationaddress_Unit,
}

func (e *Mappingdestinationaddress) 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 "country":
		*e = Mappingdestinationaddress_Country
	case "locality":
		*e = Mappingdestinationaddress_Locality
	case "postal_code":
		*e = Mappingdestinationaddress_PostalCode
	case "street":
		*e = Mappingdestinationaddress_Street
	case "unit":
		*e = Mappingdestinationaddress_Unit
	default:
		return errors.New("jet: Invalid scan value '" + enumValue + "' for Mappingdestinationaddress enum")
	}

	return nil
}

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