// Code generated by go generate; DO NOT EDIT.
package commonv3

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

// Scan converts database string to RafayConditionStatus
func (e *RafayConditionStatus) Scan(value interface{}) error {
	s := value.([]byte)
	*e = RafayConditionStatus(RafayConditionStatus_value[string(s)])
	return nil
}

// Value converts RafayConditionStatus into database string
func (e RafayConditionStatus) Value() (driver.Value, error) {
	return RafayConditionStatus_name[int32(e)], nil
}

// MarshalJSON converts RafayConditionStatus to JSON
func (e RafayConditionStatus) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString("\"")
	buffer.WriteString(e.String())
	buffer.WriteString("\"")
	return buffer.Bytes(), nil
}

// UnmarshalJSON converts RafayConditionStatus from JSON
func (e *RafayConditionStatus) UnmarshalJSON(b []byte) error {
	if b != nil {
		var length int
		if len(b) > 1 {
			length = len(b) - 1
		} else {
			length = len(b)
		}
		*e = RafayConditionStatus(RafayConditionStatus_value[string(b[1:length])])
	}
	return nil
}

// implement proto enum interface
func (e RafayConditionStatus) IsEnum() {
}
