// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT.
/*
 * SOURCE:
 *     schema.avsc
 */
package avro

import (
	"encoding/json"
	"fmt"
	"io"

	"github.com/actgardner/gogen-avro/v10/vm"
	"github.com/actgardner/gogen-avro/v10/vm/types"
)

var _ = fmt.Printf

type ComCompanySharedSomeEnum int32

const (
	ComCompanySharedSomeEnumX ComCompanySharedSomeEnum = 0
	ComCompanySharedSomeEnumY ComCompanySharedSomeEnum = 1
)

func (e ComCompanySharedSomeEnum) String() string {
	switch e {
	case ComCompanySharedSomeEnumX:
		return "X"
	case ComCompanySharedSomeEnumY:
		return "Y"
	}
	return "unknown"
}

func writeComCompanySharedSomeEnum(r ComCompanySharedSomeEnum, w io.Writer) error {
	return vm.WriteInt(int32(r), w)
}

func NewComCompanySharedSomeEnumValue(raw string) (r ComCompanySharedSomeEnum, err error) {
	switch raw {
	case "X":
		return ComCompanySharedSomeEnumX, nil
	case "Y":
		return ComCompanySharedSomeEnumY, nil
	}

	return -1, fmt.Errorf("invalid value for ComCompanySharedSomeEnum: '%s'", raw)

}

func (b ComCompanySharedSomeEnum) MarshalJSON() ([]byte, error) {
	return json.Marshal(b.String())
}

func (b *ComCompanySharedSomeEnum) UnmarshalJSON(data []byte) error {
	var stringVal string
	err := json.Unmarshal(data, &stringVal)
	if err != nil {
		return err
	}
	val, err := NewComCompanySharedSomeEnumValue(stringVal)
	*b = val
	return err
}

type ComCompanySharedSomeEnumWrapper struct {
	Target *ComCompanySharedSomeEnum
}

func (b ComCompanySharedSomeEnumWrapper) SetBoolean(v bool) {
	panic("Unable to assign boolean to int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetInt(v int32) {
	*(b.Target) = ComCompanySharedSomeEnum(v)
}

func (b ComCompanySharedSomeEnumWrapper) SetLong(v int64) {
	panic("Unable to assign long to int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetFloat(v float32) {
	panic("Unable to assign float to int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetUnionElem(v int64) {
	panic("Unable to assign union elem to int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetDouble(v float64) {
	panic("Unable to assign double to int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetBytes(v []byte) {
	panic("Unable to assign bytes to int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetString(v string) {
	panic("Unable to assign string to int field")
}

func (b ComCompanySharedSomeEnumWrapper) Get(i int) types.Field {
	panic("Unable to get field from int field")
}

func (b ComCompanySharedSomeEnumWrapper) SetDefault(i int) {
	panic("Unable to set default on int field")
}

func (b ComCompanySharedSomeEnumWrapper) AppendMap(key string) types.Field {
	panic("Unable to append map key to from int field")
}

func (b ComCompanySharedSomeEnumWrapper) AppendArray() types.Field {
	panic("Unable to append array element to from int field")
}

func (b ComCompanySharedSomeEnumWrapper) NullField(int) {
	panic("Unable to null field in int field")
}

func (b ComCompanySharedSomeEnumWrapper) HintSize(int) {
	panic("Unable to hint size in int field")
}

func (b ComCompanySharedSomeEnumWrapper) Finalize() {}
