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

import (
	"encoding/json"
	"errors"
)

/// Supported schema types
type SchemaType int32

const (
	SchemaTypeMessageSchema SchemaType = iota
)

func (v SchemaType) String() string {
	switch v {
	case SchemaTypeMessageSchema:
		return "MessageSchema"
	default:
		return ""
	}
}

func (v SchemaType) MarshalJSON() ([]byte, error) {
	var s string
	switch v {
	case SchemaTypeMessageSchema:
		s = "MessageSchema"
	default:
		return []byte{}, errors.New("unable to marshal unrecognized enum value to JSON")
	}

	return json.Marshal(s)
}

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

	switch s {
	case "MessageSchema":
		*v = SchemaTypeMessageSchema
	default:
		return errors.New("unable to unmarshal unrecognized enum value from JSON")
	}

	return nil
}
