func (m *TTNMarshaler) NewEncoder(w io.Writer) runtime.Encoder {
	return &TTNEncoder{w: w, gogo: m.GoGoJSONPb}
}
NewEncoder returns a new JSON encoder that writes values to w.
package jsonpb
import (
	"bytes"
	"context"
	"encoding/json"
	"io"
	"github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
	"github.com/grpc-ecosystem/grpc-gateway/runtime"
	"go.thethings.network/lorawan-stack/v3/pkg/experimental"
)
var jsonpluginFeatureFlag = experimental.DefineFeature("jsonpb.jsonplugin", false)
func TTN() *TTNMarshaler {
	return &TTNMarshaler{
		GoGoJSONPb: &GoGoJSONPb{
			OrigName:    true,
			EnumsAsInts: true,
		},
	}
}
type TTNMarshaler struct {
	*GoGoJSONPb
}
func (*TTNMarshaler) ContentType() string { return "application/json" }
func (m *TTNMarshaler) Marshal(v interface{}) ([]byte, error) {
	if jsonpluginFeatureFlag.GetValue(context.Background()) {
		if marshaler, ok := v.(jsonplugin.Marshaler); ok {
			b, err := jsonplugin.MarshalerConfig{
				EnumsAsInts: true,
			}.Marshal(marshaler)
			if err != nil {
				return nil, err
			}
			if m.GoGoJSONPb.Indent == "" {
				return b, nil
			}
			var buf bytes.Buffer
			if err = json.Indent(&buf, b, "", m.GoGoJSONPb.Indent); err != nil {
				return nil, err
			}
			return buf.Bytes(), nil
		}
	}
	return m.GoGoJSONPb.Marshal(v)
}