package transport

import (
	toki "git.toki-labs.com/toki/proto-socket/go"
	"google.golang.org/protobuf/proto"

	iop "iop/proto/gen/iop"
)

func nodeParserMap() toki.ParserMap {
	return toki.ParserMap{
		toki.TypeNameOf(&iop.RunRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.RunRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.ProviderTunnelRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.ProviderTunnelRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.EdgeNodeEvent{}): func(b []byte) (proto.Message, error) {
			m := &iop.EdgeNodeEvent{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.CancelRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.CancelRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.NodeCommandRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.NodeCommandRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.RegisterResponse{}): func(b []byte) (proto.Message, error) {
			m := &iop.RegisterResponse{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.NodeReadyResponse{}): func(b []byte) (proto.Message, error) {
			m := &iop.NodeReadyResponse{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.NodeConfigRefreshRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.NodeConfigRefreshRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.WorkspaceOpenRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.WorkspaceOpenRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.WorkspaceToolRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.WorkspaceToolRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.WorkspaceArtifactRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.WorkspaceArtifactRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.WorkspaceCancelRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.WorkspaceCancelRequest{}
			return m, proto.Unmarshal(b, m)
		},
		toki.TypeNameOf(&iop.WorkspaceCleanupRequest{}): func(b []byte) (proto.Message, error) {
			m := &iop.WorkspaceCleanupRequest{}
			return m, proto.Unmarshal(b, m)
		},
	}
}
