// Code generated by Azure.Iot.Operations.ProtocolCompilerLib v0.10.0.0; DO NOT EDIT.
package schemaregistry

import (
	"encoding/json"
)

type SchemaRegistryErrorCode int32

const (
	SchemaRegistryErrorCodeBadRequest SchemaRegistryErrorCode = 400
	SchemaRegistryErrorCodeInternalError SchemaRegistryErrorCode = 500
	SchemaRegistryErrorCodeNotFound SchemaRegistryErrorCode = 404
)

func (v SchemaRegistryErrorCode) String() string {
	switch v {
	case SchemaRegistryErrorCodeBadRequest:
		return "BadRequest"
	case SchemaRegistryErrorCodeInternalError:
		return "InternalError"
	case SchemaRegistryErrorCodeNotFound:
		return "NotFound"
	default:
		return ""
	}
}

func (v SchemaRegistryErrorCode) MarshalJSON() ([]byte, error) {
	return json.Marshal(int32(v))
}

func (v *SchemaRegistryErrorCode) UnmarshalJSON(b []byte) error {
	var s int32
	if err := json.Unmarshal(b, &s); err != nil {
		return err
	}

	*v = SchemaRegistryErrorCode(s)
	return nil
}
