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

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

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

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

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

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

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