// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// SendMessageTypingAction represents TL type `sendMessageTypingAction#16bf744e`.
// User is typing.
//
// See https://core.telegram.org/constructor/sendMessageTypingAction for reference.
type SendMessageTypingAction struct {
}

// SendMessageTypingActionTypeID is TL type id of SendMessageTypingAction.
const SendMessageTypingActionTypeID = 0x16bf744e

// construct implements constructor of SendMessageActionClass.
func (s SendMessageTypingAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageTypingAction.
var (
	_ bin.Encoder     = &SendMessageTypingAction{}
	_ bin.Decoder     = &SendMessageTypingAction{}
	_ bin.BareEncoder = &SendMessageTypingAction{}
	_ bin.BareDecoder = &SendMessageTypingAction{}

	_ SendMessageActionClass = &SendMessageTypingAction{}
)

func (s *SendMessageTypingAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageTypingAction) String() string {
	if s == nil {
		return "SendMessageTypingAction(nil)"
	}
	type Alias SendMessageTypingAction
	return fmt.Sprintf("SendMessageTypingAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageTypingAction) TypeID() uint32 {
	return SendMessageTypingActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageTypingAction) TypeName() string {
	return "sendMessageTypingAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageTypingAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageTypingAction",
		ID:   SendMessageTypingActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageTypingAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageTypingAction#16bf744e as nil")
	}
	b.PutID(SendMessageTypingActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageTypingAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageTypingAction#16bf744e as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageTypingAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageTypingAction#16bf744e to nil")
	}
	if err := b.ConsumeID(SendMessageTypingActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageTypingAction#16bf744e: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageTypingAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageTypingAction#16bf744e to nil")
	}
	return nil
}

// SendMessageCancelAction represents TL type `sendMessageCancelAction#fd5ec8f5`.
// Invalidate all previous action updates. E.g. when user deletes entered text or aborts
// a video upload.
//
// See https://core.telegram.org/constructor/sendMessageCancelAction for reference.
type SendMessageCancelAction struct {
}

// SendMessageCancelActionTypeID is TL type id of SendMessageCancelAction.
const SendMessageCancelActionTypeID = 0xfd5ec8f5

// construct implements constructor of SendMessageActionClass.
func (s SendMessageCancelAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageCancelAction.
var (
	_ bin.Encoder     = &SendMessageCancelAction{}
	_ bin.Decoder     = &SendMessageCancelAction{}
	_ bin.BareEncoder = &SendMessageCancelAction{}
	_ bin.BareDecoder = &SendMessageCancelAction{}

	_ SendMessageActionClass = &SendMessageCancelAction{}
)

func (s *SendMessageCancelAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageCancelAction) String() string {
	if s == nil {
		return "SendMessageCancelAction(nil)"
	}
	type Alias SendMessageCancelAction
	return fmt.Sprintf("SendMessageCancelAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageCancelAction) TypeID() uint32 {
	return SendMessageCancelActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageCancelAction) TypeName() string {
	return "sendMessageCancelAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageCancelAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageCancelAction",
		ID:   SendMessageCancelActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageCancelAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageCancelAction#fd5ec8f5 as nil")
	}
	b.PutID(SendMessageCancelActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageCancelAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageCancelAction#fd5ec8f5 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageCancelAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageCancelAction#fd5ec8f5 to nil")
	}
	if err := b.ConsumeID(SendMessageCancelActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageCancelAction#fd5ec8f5: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageCancelAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageCancelAction#fd5ec8f5 to nil")
	}
	return nil
}

// SendMessageRecordVideoAction represents TL type `sendMessageRecordVideoAction#a187d66f`.
// User is recording a video.
//
// See https://core.telegram.org/constructor/sendMessageRecordVideoAction for reference.
type SendMessageRecordVideoAction struct {
}

// SendMessageRecordVideoActionTypeID is TL type id of SendMessageRecordVideoAction.
const SendMessageRecordVideoActionTypeID = 0xa187d66f

// construct implements constructor of SendMessageActionClass.
func (s SendMessageRecordVideoAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageRecordVideoAction.
var (
	_ bin.Encoder     = &SendMessageRecordVideoAction{}
	_ bin.Decoder     = &SendMessageRecordVideoAction{}
	_ bin.BareEncoder = &SendMessageRecordVideoAction{}
	_ bin.BareDecoder = &SendMessageRecordVideoAction{}

	_ SendMessageActionClass = &SendMessageRecordVideoAction{}
)

func (s *SendMessageRecordVideoAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageRecordVideoAction) String() string {
	if s == nil {
		return "SendMessageRecordVideoAction(nil)"
	}
	type Alias SendMessageRecordVideoAction
	return fmt.Sprintf("SendMessageRecordVideoAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageRecordVideoAction) TypeID() uint32 {
	return SendMessageRecordVideoActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageRecordVideoAction) TypeName() string {
	return "sendMessageRecordVideoAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageRecordVideoAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageRecordVideoAction",
		ID:   SendMessageRecordVideoActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageRecordVideoAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageRecordVideoAction#a187d66f as nil")
	}
	b.PutID(SendMessageRecordVideoActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageRecordVideoAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageRecordVideoAction#a187d66f as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageRecordVideoAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageRecordVideoAction#a187d66f to nil")
	}
	if err := b.ConsumeID(SendMessageRecordVideoActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageRecordVideoAction#a187d66f: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageRecordVideoAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageRecordVideoAction#a187d66f to nil")
	}
	return nil
}

// SendMessageUploadVideoAction represents TL type `sendMessageUploadVideoAction#e9763aec`.
// User is uploading a video.
//
// See https://core.telegram.org/constructor/sendMessageUploadVideoAction for reference.
type SendMessageUploadVideoAction struct {
	// Progress percentage
	Progress int
}

// SendMessageUploadVideoActionTypeID is TL type id of SendMessageUploadVideoAction.
const SendMessageUploadVideoActionTypeID = 0xe9763aec

// construct implements constructor of SendMessageActionClass.
func (s SendMessageUploadVideoAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageUploadVideoAction.
var (
	_ bin.Encoder     = &SendMessageUploadVideoAction{}
	_ bin.Decoder     = &SendMessageUploadVideoAction{}
	_ bin.BareEncoder = &SendMessageUploadVideoAction{}
	_ bin.BareDecoder = &SendMessageUploadVideoAction{}

	_ SendMessageActionClass = &SendMessageUploadVideoAction{}
)

func (s *SendMessageUploadVideoAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Progress == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageUploadVideoAction) String() string {
	if s == nil {
		return "SendMessageUploadVideoAction(nil)"
	}
	type Alias SendMessageUploadVideoAction
	return fmt.Sprintf("SendMessageUploadVideoAction%+v", Alias(*s))
}

// FillFrom fills SendMessageUploadVideoAction from given interface.
func (s *SendMessageUploadVideoAction) FillFrom(from interface {
	GetProgress() (value int)
}) {
	s.Progress = from.GetProgress()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageUploadVideoAction) TypeID() uint32 {
	return SendMessageUploadVideoActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageUploadVideoAction) TypeName() string {
	return "sendMessageUploadVideoAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageUploadVideoAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageUploadVideoAction",
		ID:   SendMessageUploadVideoActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Progress",
			SchemaName: "progress",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageUploadVideoAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadVideoAction#e9763aec as nil")
	}
	b.PutID(SendMessageUploadVideoActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageUploadVideoAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadVideoAction#e9763aec as nil")
	}
	b.PutInt(s.Progress)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageUploadVideoAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadVideoAction#e9763aec to nil")
	}
	if err := b.ConsumeID(SendMessageUploadVideoActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageUploadVideoAction#e9763aec: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageUploadVideoAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadVideoAction#e9763aec to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageUploadVideoAction#e9763aec: field progress: %w", err)
		}
		s.Progress = value
	}
	return nil
}

// GetProgress returns value of Progress field.
func (s *SendMessageUploadVideoAction) GetProgress() (value int) {
	if s == nil {
		return
	}
	return s.Progress
}

// SendMessageRecordAudioAction represents TL type `sendMessageRecordAudioAction#d52f73f7`.
// User is recording a voice message.
//
// See https://core.telegram.org/constructor/sendMessageRecordAudioAction for reference.
type SendMessageRecordAudioAction struct {
}

// SendMessageRecordAudioActionTypeID is TL type id of SendMessageRecordAudioAction.
const SendMessageRecordAudioActionTypeID = 0xd52f73f7

// construct implements constructor of SendMessageActionClass.
func (s SendMessageRecordAudioAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageRecordAudioAction.
var (
	_ bin.Encoder     = &SendMessageRecordAudioAction{}
	_ bin.Decoder     = &SendMessageRecordAudioAction{}
	_ bin.BareEncoder = &SendMessageRecordAudioAction{}
	_ bin.BareDecoder = &SendMessageRecordAudioAction{}

	_ SendMessageActionClass = &SendMessageRecordAudioAction{}
)

func (s *SendMessageRecordAudioAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageRecordAudioAction) String() string {
	if s == nil {
		return "SendMessageRecordAudioAction(nil)"
	}
	type Alias SendMessageRecordAudioAction
	return fmt.Sprintf("SendMessageRecordAudioAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageRecordAudioAction) TypeID() uint32 {
	return SendMessageRecordAudioActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageRecordAudioAction) TypeName() string {
	return "sendMessageRecordAudioAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageRecordAudioAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageRecordAudioAction",
		ID:   SendMessageRecordAudioActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageRecordAudioAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageRecordAudioAction#d52f73f7 as nil")
	}
	b.PutID(SendMessageRecordAudioActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageRecordAudioAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageRecordAudioAction#d52f73f7 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageRecordAudioAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageRecordAudioAction#d52f73f7 to nil")
	}
	if err := b.ConsumeID(SendMessageRecordAudioActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageRecordAudioAction#d52f73f7: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageRecordAudioAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageRecordAudioAction#d52f73f7 to nil")
	}
	return nil
}

// SendMessageUploadAudioAction represents TL type `sendMessageUploadAudioAction#f351d7ab`.
// User is uploading a voice message.
//
// See https://core.telegram.org/constructor/sendMessageUploadAudioAction for reference.
type SendMessageUploadAudioAction struct {
	// Progress percentage
	Progress int
}

// SendMessageUploadAudioActionTypeID is TL type id of SendMessageUploadAudioAction.
const SendMessageUploadAudioActionTypeID = 0xf351d7ab

// construct implements constructor of SendMessageActionClass.
func (s SendMessageUploadAudioAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageUploadAudioAction.
var (
	_ bin.Encoder     = &SendMessageUploadAudioAction{}
	_ bin.Decoder     = &SendMessageUploadAudioAction{}
	_ bin.BareEncoder = &SendMessageUploadAudioAction{}
	_ bin.BareDecoder = &SendMessageUploadAudioAction{}

	_ SendMessageActionClass = &SendMessageUploadAudioAction{}
)

func (s *SendMessageUploadAudioAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Progress == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageUploadAudioAction) String() string {
	if s == nil {
		return "SendMessageUploadAudioAction(nil)"
	}
	type Alias SendMessageUploadAudioAction
	return fmt.Sprintf("SendMessageUploadAudioAction%+v", Alias(*s))
}

// FillFrom fills SendMessageUploadAudioAction from given interface.
func (s *SendMessageUploadAudioAction) FillFrom(from interface {
	GetProgress() (value int)
}) {
	s.Progress = from.GetProgress()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageUploadAudioAction) TypeID() uint32 {
	return SendMessageUploadAudioActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageUploadAudioAction) TypeName() string {
	return "sendMessageUploadAudioAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageUploadAudioAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageUploadAudioAction",
		ID:   SendMessageUploadAudioActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Progress",
			SchemaName: "progress",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageUploadAudioAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadAudioAction#f351d7ab as nil")
	}
	b.PutID(SendMessageUploadAudioActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageUploadAudioAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadAudioAction#f351d7ab as nil")
	}
	b.PutInt(s.Progress)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageUploadAudioAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadAudioAction#f351d7ab to nil")
	}
	if err := b.ConsumeID(SendMessageUploadAudioActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageUploadAudioAction#f351d7ab: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageUploadAudioAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadAudioAction#f351d7ab to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageUploadAudioAction#f351d7ab: field progress: %w", err)
		}
		s.Progress = value
	}
	return nil
}

// GetProgress returns value of Progress field.
func (s *SendMessageUploadAudioAction) GetProgress() (value int) {
	if s == nil {
		return
	}
	return s.Progress
}

// SendMessageUploadPhotoAction represents TL type `sendMessageUploadPhotoAction#d1d34a26`.
// User is uploading a photo.
//
// See https://core.telegram.org/constructor/sendMessageUploadPhotoAction for reference.
type SendMessageUploadPhotoAction struct {
	// Progress percentage
	Progress int
}

// SendMessageUploadPhotoActionTypeID is TL type id of SendMessageUploadPhotoAction.
const SendMessageUploadPhotoActionTypeID = 0xd1d34a26

// construct implements constructor of SendMessageActionClass.
func (s SendMessageUploadPhotoAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageUploadPhotoAction.
var (
	_ bin.Encoder     = &SendMessageUploadPhotoAction{}
	_ bin.Decoder     = &SendMessageUploadPhotoAction{}
	_ bin.BareEncoder = &SendMessageUploadPhotoAction{}
	_ bin.BareDecoder = &SendMessageUploadPhotoAction{}

	_ SendMessageActionClass = &SendMessageUploadPhotoAction{}
)

func (s *SendMessageUploadPhotoAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Progress == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageUploadPhotoAction) String() string {
	if s == nil {
		return "SendMessageUploadPhotoAction(nil)"
	}
	type Alias SendMessageUploadPhotoAction
	return fmt.Sprintf("SendMessageUploadPhotoAction%+v", Alias(*s))
}

// FillFrom fills SendMessageUploadPhotoAction from given interface.
func (s *SendMessageUploadPhotoAction) FillFrom(from interface {
	GetProgress() (value int)
}) {
	s.Progress = from.GetProgress()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageUploadPhotoAction) TypeID() uint32 {
	return SendMessageUploadPhotoActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageUploadPhotoAction) TypeName() string {
	return "sendMessageUploadPhotoAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageUploadPhotoAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageUploadPhotoAction",
		ID:   SendMessageUploadPhotoActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Progress",
			SchemaName: "progress",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageUploadPhotoAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadPhotoAction#d1d34a26 as nil")
	}
	b.PutID(SendMessageUploadPhotoActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageUploadPhotoAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadPhotoAction#d1d34a26 as nil")
	}
	b.PutInt(s.Progress)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageUploadPhotoAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadPhotoAction#d1d34a26 to nil")
	}
	if err := b.ConsumeID(SendMessageUploadPhotoActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageUploadPhotoAction#d1d34a26: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageUploadPhotoAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadPhotoAction#d1d34a26 to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageUploadPhotoAction#d1d34a26: field progress: %w", err)
		}
		s.Progress = value
	}
	return nil
}

// GetProgress returns value of Progress field.
func (s *SendMessageUploadPhotoAction) GetProgress() (value int) {
	if s == nil {
		return
	}
	return s.Progress
}

// SendMessageUploadDocumentAction represents TL type `sendMessageUploadDocumentAction#aa0cd9e4`.
// User is uploading a file.
//
// See https://core.telegram.org/constructor/sendMessageUploadDocumentAction for reference.
type SendMessageUploadDocumentAction struct {
	// Progress percentage
	Progress int
}

// SendMessageUploadDocumentActionTypeID is TL type id of SendMessageUploadDocumentAction.
const SendMessageUploadDocumentActionTypeID = 0xaa0cd9e4

// construct implements constructor of SendMessageActionClass.
func (s SendMessageUploadDocumentAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageUploadDocumentAction.
var (
	_ bin.Encoder     = &SendMessageUploadDocumentAction{}
	_ bin.Decoder     = &SendMessageUploadDocumentAction{}
	_ bin.BareEncoder = &SendMessageUploadDocumentAction{}
	_ bin.BareDecoder = &SendMessageUploadDocumentAction{}

	_ SendMessageActionClass = &SendMessageUploadDocumentAction{}
)

func (s *SendMessageUploadDocumentAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Progress == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageUploadDocumentAction) String() string {
	if s == nil {
		return "SendMessageUploadDocumentAction(nil)"
	}
	type Alias SendMessageUploadDocumentAction
	return fmt.Sprintf("SendMessageUploadDocumentAction%+v", Alias(*s))
}

// FillFrom fills SendMessageUploadDocumentAction from given interface.
func (s *SendMessageUploadDocumentAction) FillFrom(from interface {
	GetProgress() (value int)
}) {
	s.Progress = from.GetProgress()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageUploadDocumentAction) TypeID() uint32 {
	return SendMessageUploadDocumentActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageUploadDocumentAction) TypeName() string {
	return "sendMessageUploadDocumentAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageUploadDocumentAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageUploadDocumentAction",
		ID:   SendMessageUploadDocumentActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Progress",
			SchemaName: "progress",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageUploadDocumentAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadDocumentAction#aa0cd9e4 as nil")
	}
	b.PutID(SendMessageUploadDocumentActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageUploadDocumentAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadDocumentAction#aa0cd9e4 as nil")
	}
	b.PutInt(s.Progress)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageUploadDocumentAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadDocumentAction#aa0cd9e4 to nil")
	}
	if err := b.ConsumeID(SendMessageUploadDocumentActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageUploadDocumentAction#aa0cd9e4: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageUploadDocumentAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadDocumentAction#aa0cd9e4 to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageUploadDocumentAction#aa0cd9e4: field progress: %w", err)
		}
		s.Progress = value
	}
	return nil
}

// GetProgress returns value of Progress field.
func (s *SendMessageUploadDocumentAction) GetProgress() (value int) {
	if s == nil {
		return
	}
	return s.Progress
}

// SendMessageGeoLocationAction represents TL type `sendMessageGeoLocationAction#176f8ba1`.
// User is selecting a location to share.
//
// See https://core.telegram.org/constructor/sendMessageGeoLocationAction for reference.
type SendMessageGeoLocationAction struct {
}

// SendMessageGeoLocationActionTypeID is TL type id of SendMessageGeoLocationAction.
const SendMessageGeoLocationActionTypeID = 0x176f8ba1

// construct implements constructor of SendMessageActionClass.
func (s SendMessageGeoLocationAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageGeoLocationAction.
var (
	_ bin.Encoder     = &SendMessageGeoLocationAction{}
	_ bin.Decoder     = &SendMessageGeoLocationAction{}
	_ bin.BareEncoder = &SendMessageGeoLocationAction{}
	_ bin.BareDecoder = &SendMessageGeoLocationAction{}

	_ SendMessageActionClass = &SendMessageGeoLocationAction{}
)

func (s *SendMessageGeoLocationAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageGeoLocationAction) String() string {
	if s == nil {
		return "SendMessageGeoLocationAction(nil)"
	}
	type Alias SendMessageGeoLocationAction
	return fmt.Sprintf("SendMessageGeoLocationAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageGeoLocationAction) TypeID() uint32 {
	return SendMessageGeoLocationActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageGeoLocationAction) TypeName() string {
	return "sendMessageGeoLocationAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageGeoLocationAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageGeoLocationAction",
		ID:   SendMessageGeoLocationActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageGeoLocationAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageGeoLocationAction#176f8ba1 as nil")
	}
	b.PutID(SendMessageGeoLocationActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageGeoLocationAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageGeoLocationAction#176f8ba1 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageGeoLocationAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageGeoLocationAction#176f8ba1 to nil")
	}
	if err := b.ConsumeID(SendMessageGeoLocationActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageGeoLocationAction#176f8ba1: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageGeoLocationAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageGeoLocationAction#176f8ba1 to nil")
	}
	return nil
}

// SendMessageChooseContactAction represents TL type `sendMessageChooseContactAction#628cbc6f`.
// User is selecting a contact to share.
//
// See https://core.telegram.org/constructor/sendMessageChooseContactAction for reference.
type SendMessageChooseContactAction struct {
}

// SendMessageChooseContactActionTypeID is TL type id of SendMessageChooseContactAction.
const SendMessageChooseContactActionTypeID = 0x628cbc6f

// construct implements constructor of SendMessageActionClass.
func (s SendMessageChooseContactAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageChooseContactAction.
var (
	_ bin.Encoder     = &SendMessageChooseContactAction{}
	_ bin.Decoder     = &SendMessageChooseContactAction{}
	_ bin.BareEncoder = &SendMessageChooseContactAction{}
	_ bin.BareDecoder = &SendMessageChooseContactAction{}

	_ SendMessageActionClass = &SendMessageChooseContactAction{}
)

func (s *SendMessageChooseContactAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageChooseContactAction) String() string {
	if s == nil {
		return "SendMessageChooseContactAction(nil)"
	}
	type Alias SendMessageChooseContactAction
	return fmt.Sprintf("SendMessageChooseContactAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageChooseContactAction) TypeID() uint32 {
	return SendMessageChooseContactActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageChooseContactAction) TypeName() string {
	return "sendMessageChooseContactAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageChooseContactAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageChooseContactAction",
		ID:   SendMessageChooseContactActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageChooseContactAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageChooseContactAction#628cbc6f as nil")
	}
	b.PutID(SendMessageChooseContactActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageChooseContactAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageChooseContactAction#628cbc6f as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageChooseContactAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageChooseContactAction#628cbc6f to nil")
	}
	if err := b.ConsumeID(SendMessageChooseContactActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageChooseContactAction#628cbc6f: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageChooseContactAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageChooseContactAction#628cbc6f to nil")
	}
	return nil
}

// SendMessageGamePlayAction represents TL type `sendMessageGamePlayAction#dd6a8f48`.
// User is playing a game
//
// See https://core.telegram.org/constructor/sendMessageGamePlayAction for reference.
type SendMessageGamePlayAction struct {
}

// SendMessageGamePlayActionTypeID is TL type id of SendMessageGamePlayAction.
const SendMessageGamePlayActionTypeID = 0xdd6a8f48

// construct implements constructor of SendMessageActionClass.
func (s SendMessageGamePlayAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageGamePlayAction.
var (
	_ bin.Encoder     = &SendMessageGamePlayAction{}
	_ bin.Decoder     = &SendMessageGamePlayAction{}
	_ bin.BareEncoder = &SendMessageGamePlayAction{}
	_ bin.BareDecoder = &SendMessageGamePlayAction{}

	_ SendMessageActionClass = &SendMessageGamePlayAction{}
)

func (s *SendMessageGamePlayAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageGamePlayAction) String() string {
	if s == nil {
		return "SendMessageGamePlayAction(nil)"
	}
	type Alias SendMessageGamePlayAction
	return fmt.Sprintf("SendMessageGamePlayAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageGamePlayAction) TypeID() uint32 {
	return SendMessageGamePlayActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageGamePlayAction) TypeName() string {
	return "sendMessageGamePlayAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageGamePlayAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageGamePlayAction",
		ID:   SendMessageGamePlayActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageGamePlayAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageGamePlayAction#dd6a8f48 as nil")
	}
	b.PutID(SendMessageGamePlayActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageGamePlayAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageGamePlayAction#dd6a8f48 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageGamePlayAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageGamePlayAction#dd6a8f48 to nil")
	}
	if err := b.ConsumeID(SendMessageGamePlayActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageGamePlayAction#dd6a8f48: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageGamePlayAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageGamePlayAction#dd6a8f48 to nil")
	}
	return nil
}

// SendMessageRecordRoundAction represents TL type `sendMessageRecordRoundAction#88f27fbc`.
// User is recording a round video to share
//
// See https://core.telegram.org/constructor/sendMessageRecordRoundAction for reference.
type SendMessageRecordRoundAction struct {
}

// SendMessageRecordRoundActionTypeID is TL type id of SendMessageRecordRoundAction.
const SendMessageRecordRoundActionTypeID = 0x88f27fbc

// construct implements constructor of SendMessageActionClass.
func (s SendMessageRecordRoundAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageRecordRoundAction.
var (
	_ bin.Encoder     = &SendMessageRecordRoundAction{}
	_ bin.Decoder     = &SendMessageRecordRoundAction{}
	_ bin.BareEncoder = &SendMessageRecordRoundAction{}
	_ bin.BareDecoder = &SendMessageRecordRoundAction{}

	_ SendMessageActionClass = &SendMessageRecordRoundAction{}
)

func (s *SendMessageRecordRoundAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageRecordRoundAction) String() string {
	if s == nil {
		return "SendMessageRecordRoundAction(nil)"
	}
	type Alias SendMessageRecordRoundAction
	return fmt.Sprintf("SendMessageRecordRoundAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageRecordRoundAction) TypeID() uint32 {
	return SendMessageRecordRoundActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageRecordRoundAction) TypeName() string {
	return "sendMessageRecordRoundAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageRecordRoundAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageRecordRoundAction",
		ID:   SendMessageRecordRoundActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageRecordRoundAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageRecordRoundAction#88f27fbc as nil")
	}
	b.PutID(SendMessageRecordRoundActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageRecordRoundAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageRecordRoundAction#88f27fbc as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageRecordRoundAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageRecordRoundAction#88f27fbc to nil")
	}
	if err := b.ConsumeID(SendMessageRecordRoundActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageRecordRoundAction#88f27fbc: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageRecordRoundAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageRecordRoundAction#88f27fbc to nil")
	}
	return nil
}

// SendMessageUploadRoundAction represents TL type `sendMessageUploadRoundAction#243e1c66`.
// User is uploading a round video
//
// See https://core.telegram.org/constructor/sendMessageUploadRoundAction for reference.
type SendMessageUploadRoundAction struct {
	// Progress percentage
	Progress int
}

// SendMessageUploadRoundActionTypeID is TL type id of SendMessageUploadRoundAction.
const SendMessageUploadRoundActionTypeID = 0x243e1c66

// construct implements constructor of SendMessageActionClass.
func (s SendMessageUploadRoundAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageUploadRoundAction.
var (
	_ bin.Encoder     = &SendMessageUploadRoundAction{}
	_ bin.Decoder     = &SendMessageUploadRoundAction{}
	_ bin.BareEncoder = &SendMessageUploadRoundAction{}
	_ bin.BareDecoder = &SendMessageUploadRoundAction{}

	_ SendMessageActionClass = &SendMessageUploadRoundAction{}
)

func (s *SendMessageUploadRoundAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Progress == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageUploadRoundAction) String() string {
	if s == nil {
		return "SendMessageUploadRoundAction(nil)"
	}
	type Alias SendMessageUploadRoundAction
	return fmt.Sprintf("SendMessageUploadRoundAction%+v", Alias(*s))
}

// FillFrom fills SendMessageUploadRoundAction from given interface.
func (s *SendMessageUploadRoundAction) FillFrom(from interface {
	GetProgress() (value int)
}) {
	s.Progress = from.GetProgress()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageUploadRoundAction) TypeID() uint32 {
	return SendMessageUploadRoundActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageUploadRoundAction) TypeName() string {
	return "sendMessageUploadRoundAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageUploadRoundAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageUploadRoundAction",
		ID:   SendMessageUploadRoundActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Progress",
			SchemaName: "progress",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageUploadRoundAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadRoundAction#243e1c66 as nil")
	}
	b.PutID(SendMessageUploadRoundActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageUploadRoundAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageUploadRoundAction#243e1c66 as nil")
	}
	b.PutInt(s.Progress)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageUploadRoundAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadRoundAction#243e1c66 to nil")
	}
	if err := b.ConsumeID(SendMessageUploadRoundActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageUploadRoundAction#243e1c66: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageUploadRoundAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageUploadRoundAction#243e1c66 to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageUploadRoundAction#243e1c66: field progress: %w", err)
		}
		s.Progress = value
	}
	return nil
}

// GetProgress returns value of Progress field.
func (s *SendMessageUploadRoundAction) GetProgress() (value int) {
	if s == nil {
		return
	}
	return s.Progress
}

// SpeakingInGroupCallAction represents TL type `speakingInGroupCallAction#d92c2285`.
// User is currently speaking in the group call
//
// See https://core.telegram.org/constructor/speakingInGroupCallAction for reference.
type SpeakingInGroupCallAction struct {
}

// SpeakingInGroupCallActionTypeID is TL type id of SpeakingInGroupCallAction.
const SpeakingInGroupCallActionTypeID = 0xd92c2285

// construct implements constructor of SendMessageActionClass.
func (s SpeakingInGroupCallAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SpeakingInGroupCallAction.
var (
	_ bin.Encoder     = &SpeakingInGroupCallAction{}
	_ bin.Decoder     = &SpeakingInGroupCallAction{}
	_ bin.BareEncoder = &SpeakingInGroupCallAction{}
	_ bin.BareDecoder = &SpeakingInGroupCallAction{}

	_ SendMessageActionClass = &SpeakingInGroupCallAction{}
)

func (s *SpeakingInGroupCallAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SpeakingInGroupCallAction) String() string {
	if s == nil {
		return "SpeakingInGroupCallAction(nil)"
	}
	type Alias SpeakingInGroupCallAction
	return fmt.Sprintf("SpeakingInGroupCallAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SpeakingInGroupCallAction) TypeID() uint32 {
	return SpeakingInGroupCallActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SpeakingInGroupCallAction) TypeName() string {
	return "speakingInGroupCallAction"
}

// TypeInfo returns info about TL type.
func (s *SpeakingInGroupCallAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "speakingInGroupCallAction",
		ID:   SpeakingInGroupCallActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SpeakingInGroupCallAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode speakingInGroupCallAction#d92c2285 as nil")
	}
	b.PutID(SpeakingInGroupCallActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SpeakingInGroupCallAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode speakingInGroupCallAction#d92c2285 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SpeakingInGroupCallAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode speakingInGroupCallAction#d92c2285 to nil")
	}
	if err := b.ConsumeID(SpeakingInGroupCallActionTypeID); err != nil {
		return fmt.Errorf("unable to decode speakingInGroupCallAction#d92c2285: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SpeakingInGroupCallAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode speakingInGroupCallAction#d92c2285 to nil")
	}
	return nil
}

// SendMessageHistoryImportAction represents TL type `sendMessageHistoryImportAction#dbda9246`.
// Chat history is being imported
//
// See https://core.telegram.org/constructor/sendMessageHistoryImportAction for reference.
type SendMessageHistoryImportAction struct {
	// Progress percentage
	Progress int
}

// SendMessageHistoryImportActionTypeID is TL type id of SendMessageHistoryImportAction.
const SendMessageHistoryImportActionTypeID = 0xdbda9246

// construct implements constructor of SendMessageActionClass.
func (s SendMessageHistoryImportAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageHistoryImportAction.
var (
	_ bin.Encoder     = &SendMessageHistoryImportAction{}
	_ bin.Decoder     = &SendMessageHistoryImportAction{}
	_ bin.BareEncoder = &SendMessageHistoryImportAction{}
	_ bin.BareDecoder = &SendMessageHistoryImportAction{}

	_ SendMessageActionClass = &SendMessageHistoryImportAction{}
)

func (s *SendMessageHistoryImportAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Progress == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageHistoryImportAction) String() string {
	if s == nil {
		return "SendMessageHistoryImportAction(nil)"
	}
	type Alias SendMessageHistoryImportAction
	return fmt.Sprintf("SendMessageHistoryImportAction%+v", Alias(*s))
}

// FillFrom fills SendMessageHistoryImportAction from given interface.
func (s *SendMessageHistoryImportAction) FillFrom(from interface {
	GetProgress() (value int)
}) {
	s.Progress = from.GetProgress()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageHistoryImportAction) TypeID() uint32 {
	return SendMessageHistoryImportActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageHistoryImportAction) TypeName() string {
	return "sendMessageHistoryImportAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageHistoryImportAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageHistoryImportAction",
		ID:   SendMessageHistoryImportActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Progress",
			SchemaName: "progress",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageHistoryImportAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageHistoryImportAction#dbda9246 as nil")
	}
	b.PutID(SendMessageHistoryImportActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageHistoryImportAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageHistoryImportAction#dbda9246 as nil")
	}
	b.PutInt(s.Progress)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageHistoryImportAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageHistoryImportAction#dbda9246 to nil")
	}
	if err := b.ConsumeID(SendMessageHistoryImportActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageHistoryImportAction#dbda9246: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageHistoryImportAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageHistoryImportAction#dbda9246 to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageHistoryImportAction#dbda9246: field progress: %w", err)
		}
		s.Progress = value
	}
	return nil
}

// GetProgress returns value of Progress field.
func (s *SendMessageHistoryImportAction) GetProgress() (value int) {
	if s == nil {
		return
	}
	return s.Progress
}

// SendMessageChooseStickerAction represents TL type `sendMessageChooseStickerAction#b05ac6b1`.
// User is choosing a sticker
//
// See https://core.telegram.org/constructor/sendMessageChooseStickerAction for reference.
type SendMessageChooseStickerAction struct {
}

// SendMessageChooseStickerActionTypeID is TL type id of SendMessageChooseStickerAction.
const SendMessageChooseStickerActionTypeID = 0xb05ac6b1

// construct implements constructor of SendMessageActionClass.
func (s SendMessageChooseStickerAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageChooseStickerAction.
var (
	_ bin.Encoder     = &SendMessageChooseStickerAction{}
	_ bin.Decoder     = &SendMessageChooseStickerAction{}
	_ bin.BareEncoder = &SendMessageChooseStickerAction{}
	_ bin.BareDecoder = &SendMessageChooseStickerAction{}

	_ SendMessageActionClass = &SendMessageChooseStickerAction{}
)

func (s *SendMessageChooseStickerAction) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageChooseStickerAction) String() string {
	if s == nil {
		return "SendMessageChooseStickerAction(nil)"
	}
	type Alias SendMessageChooseStickerAction
	return fmt.Sprintf("SendMessageChooseStickerAction%+v", Alias(*s))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageChooseStickerAction) TypeID() uint32 {
	return SendMessageChooseStickerActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageChooseStickerAction) TypeName() string {
	return "sendMessageChooseStickerAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageChooseStickerAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageChooseStickerAction",
		ID:   SendMessageChooseStickerActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageChooseStickerAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageChooseStickerAction#b05ac6b1 as nil")
	}
	b.PutID(SendMessageChooseStickerActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageChooseStickerAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageChooseStickerAction#b05ac6b1 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageChooseStickerAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageChooseStickerAction#b05ac6b1 to nil")
	}
	if err := b.ConsumeID(SendMessageChooseStickerActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageChooseStickerAction#b05ac6b1: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageChooseStickerAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageChooseStickerAction#b05ac6b1 to nil")
	}
	return nil
}

// SendMessageEmojiInteraction represents TL type `sendMessageEmojiInteraction#25972bcb`.
// User has clicked on an animated emoji triggering a reaction, click here for more info
// »¹.
//
// Links:
//  1. https://core.telegram.org/api/animated-emojis#emoji-reactions
//
// See https://core.telegram.org/constructor/sendMessageEmojiInteraction for reference.
type SendMessageEmojiInteraction struct {
	// Emoji
	Emoticon string
	// Message ID of the animated emoji that was clicked
	MsgID int
	// A JSON object with interaction info, click here for more info »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/animated-emojis#emoji-reactions
	Interaction DataJSON
}

// SendMessageEmojiInteractionTypeID is TL type id of SendMessageEmojiInteraction.
const SendMessageEmojiInteractionTypeID = 0x25972bcb

// construct implements constructor of SendMessageActionClass.
func (s SendMessageEmojiInteraction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageEmojiInteraction.
var (
	_ bin.Encoder     = &SendMessageEmojiInteraction{}
	_ bin.Decoder     = &SendMessageEmojiInteraction{}
	_ bin.BareEncoder = &SendMessageEmojiInteraction{}
	_ bin.BareDecoder = &SendMessageEmojiInteraction{}

	_ SendMessageActionClass = &SendMessageEmojiInteraction{}
)

func (s *SendMessageEmojiInteraction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Emoticon == "") {
		return false
	}
	if !(s.MsgID == 0) {
		return false
	}
	if !(s.Interaction.Zero()) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageEmojiInteraction) String() string {
	if s == nil {
		return "SendMessageEmojiInteraction(nil)"
	}
	type Alias SendMessageEmojiInteraction
	return fmt.Sprintf("SendMessageEmojiInteraction%+v", Alias(*s))
}

// FillFrom fills SendMessageEmojiInteraction from given interface.
func (s *SendMessageEmojiInteraction) FillFrom(from interface {
	GetEmoticon() (value string)
	GetMsgID() (value int)
	GetInteraction() (value DataJSON)
}) {
	s.Emoticon = from.GetEmoticon()
	s.MsgID = from.GetMsgID()
	s.Interaction = from.GetInteraction()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageEmojiInteraction) TypeID() uint32 {
	return SendMessageEmojiInteractionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageEmojiInteraction) TypeName() string {
	return "sendMessageEmojiInteraction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageEmojiInteraction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageEmojiInteraction",
		ID:   SendMessageEmojiInteractionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Emoticon",
			SchemaName: "emoticon",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "Interaction",
			SchemaName: "interaction",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageEmojiInteraction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageEmojiInteraction#25972bcb as nil")
	}
	b.PutID(SendMessageEmojiInteractionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageEmojiInteraction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageEmojiInteraction#25972bcb as nil")
	}
	b.PutString(s.Emoticon)
	b.PutInt(s.MsgID)
	if err := s.Interaction.Encode(b); err != nil {
		return fmt.Errorf("unable to encode sendMessageEmojiInteraction#25972bcb: field interaction: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageEmojiInteraction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageEmojiInteraction#25972bcb to nil")
	}
	if err := b.ConsumeID(SendMessageEmojiInteractionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageEmojiInteraction#25972bcb: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageEmojiInteraction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageEmojiInteraction#25972bcb to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageEmojiInteraction#25972bcb: field emoticon: %w", err)
		}
		s.Emoticon = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageEmojiInteraction#25972bcb: field msg_id: %w", err)
		}
		s.MsgID = value
	}
	{
		if err := s.Interaction.Decode(b); err != nil {
			return fmt.Errorf("unable to decode sendMessageEmojiInteraction#25972bcb: field interaction: %w", err)
		}
	}
	return nil
}

// GetEmoticon returns value of Emoticon field.
func (s *SendMessageEmojiInteraction) GetEmoticon() (value string) {
	if s == nil {
		return
	}
	return s.Emoticon
}

// GetMsgID returns value of MsgID field.
func (s *SendMessageEmojiInteraction) GetMsgID() (value int) {
	if s == nil {
		return
	}
	return s.MsgID
}

// GetInteraction returns value of Interaction field.
func (s *SendMessageEmojiInteraction) GetInteraction() (value DataJSON) {
	if s == nil {
		return
	}
	return s.Interaction
}

// SendMessageEmojiInteractionSeen represents TL type `sendMessageEmojiInteractionSeen#b665902e`.
// User is watching an animated emoji reaction triggered by another user, click here for
// more info »¹.
//
// Links:
//  1. https://core.telegram.org/api/animated-emojis#emoji-reactions
//
// See https://core.telegram.org/constructor/sendMessageEmojiInteractionSeen for reference.
type SendMessageEmojiInteractionSeen struct {
	// Emoji
	Emoticon string
}

// SendMessageEmojiInteractionSeenTypeID is TL type id of SendMessageEmojiInteractionSeen.
const SendMessageEmojiInteractionSeenTypeID = 0xb665902e

// construct implements constructor of SendMessageActionClass.
func (s SendMessageEmojiInteractionSeen) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageEmojiInteractionSeen.
var (
	_ bin.Encoder     = &SendMessageEmojiInteractionSeen{}
	_ bin.Decoder     = &SendMessageEmojiInteractionSeen{}
	_ bin.BareEncoder = &SendMessageEmojiInteractionSeen{}
	_ bin.BareDecoder = &SendMessageEmojiInteractionSeen{}

	_ SendMessageActionClass = &SendMessageEmojiInteractionSeen{}
)

func (s *SendMessageEmojiInteractionSeen) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.Emoticon == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageEmojiInteractionSeen) String() string {
	if s == nil {
		return "SendMessageEmojiInteractionSeen(nil)"
	}
	type Alias SendMessageEmojiInteractionSeen
	return fmt.Sprintf("SendMessageEmojiInteractionSeen%+v", Alias(*s))
}

// FillFrom fills SendMessageEmojiInteractionSeen from given interface.
func (s *SendMessageEmojiInteractionSeen) FillFrom(from interface {
	GetEmoticon() (value string)
}) {
	s.Emoticon = from.GetEmoticon()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageEmojiInteractionSeen) TypeID() uint32 {
	return SendMessageEmojiInteractionSeenTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageEmojiInteractionSeen) TypeName() string {
	return "sendMessageEmojiInteractionSeen"
}

// TypeInfo returns info about TL type.
func (s *SendMessageEmojiInteractionSeen) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageEmojiInteractionSeen",
		ID:   SendMessageEmojiInteractionSeenTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Emoticon",
			SchemaName: "emoticon",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageEmojiInteractionSeen) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageEmojiInteractionSeen#b665902e as nil")
	}
	b.PutID(SendMessageEmojiInteractionSeenTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageEmojiInteractionSeen) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageEmojiInteractionSeen#b665902e as nil")
	}
	b.PutString(s.Emoticon)
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageEmojiInteractionSeen) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageEmojiInteractionSeen#b665902e to nil")
	}
	if err := b.ConsumeID(SendMessageEmojiInteractionSeenTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageEmojiInteractionSeen#b665902e: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageEmojiInteractionSeen) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageEmojiInteractionSeen#b665902e to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageEmojiInteractionSeen#b665902e: field emoticon: %w", err)
		}
		s.Emoticon = value
	}
	return nil
}

// GetEmoticon returns value of Emoticon field.
func (s *SendMessageEmojiInteractionSeen) GetEmoticon() (value string) {
	if s == nil {
		return
	}
	return s.Emoticon
}

// SendMessageTextDraftAction represents TL type `sendMessageTextDraftAction#376d975c`.
//
// See https://core.telegram.org/constructor/sendMessageTextDraftAction for reference.
type SendMessageTextDraftAction struct {
	// RandomID field of SendMessageTextDraftAction.
	RandomID int64
	// Text field of SendMessageTextDraftAction.
	Text TextWithEntities
}

// SendMessageTextDraftActionTypeID is TL type id of SendMessageTextDraftAction.
const SendMessageTextDraftActionTypeID = 0x376d975c

// construct implements constructor of SendMessageActionClass.
func (s SendMessageTextDraftAction) construct() SendMessageActionClass { return &s }

// Ensuring interfaces in compile-time for SendMessageTextDraftAction.
var (
	_ bin.Encoder     = &SendMessageTextDraftAction{}
	_ bin.Decoder     = &SendMessageTextDraftAction{}
	_ bin.BareEncoder = &SendMessageTextDraftAction{}
	_ bin.BareDecoder = &SendMessageTextDraftAction{}

	_ SendMessageActionClass = &SendMessageTextDraftAction{}
)

func (s *SendMessageTextDraftAction) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.RandomID == 0) {
		return false
	}
	if !(s.Text.Zero()) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func (s *SendMessageTextDraftAction) String() string {
	if s == nil {
		return "SendMessageTextDraftAction(nil)"
	}
	type Alias SendMessageTextDraftAction
	return fmt.Sprintf("SendMessageTextDraftAction%+v", Alias(*s))
}

// FillFrom fills SendMessageTextDraftAction from given interface.
func (s *SendMessageTextDraftAction) FillFrom(from interface {
	GetRandomID() (value int64)
	GetText() (value TextWithEntities)
}) {
	s.RandomID = from.GetRandomID()
	s.Text = from.GetText()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*SendMessageTextDraftAction) TypeID() uint32 {
	return SendMessageTextDraftActionTypeID
}

// TypeName returns name of type in TL schema.
func (*SendMessageTextDraftAction) TypeName() string {
	return "sendMessageTextDraftAction"
}

// TypeInfo returns info about TL type.
func (s *SendMessageTextDraftAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "sendMessageTextDraftAction",
		ID:   SendMessageTextDraftActionTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "RandomID",
			SchemaName: "random_id",
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *SendMessageTextDraftAction) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageTextDraftAction#376d975c as nil")
	}
	b.PutID(SendMessageTextDraftActionTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SendMessageTextDraftAction) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode sendMessageTextDraftAction#376d975c as nil")
	}
	b.PutLong(s.RandomID)
	if err := s.Text.Encode(b); err != nil {
		return fmt.Errorf("unable to encode sendMessageTextDraftAction#376d975c: field text: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SendMessageTextDraftAction) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageTextDraftAction#376d975c to nil")
	}
	if err := b.ConsumeID(SendMessageTextDraftActionTypeID); err != nil {
		return fmt.Errorf("unable to decode sendMessageTextDraftAction#376d975c: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SendMessageTextDraftAction) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode sendMessageTextDraftAction#376d975c to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode sendMessageTextDraftAction#376d975c: field random_id: %w", err)
		}
		s.RandomID = value
	}
	{
		if err := s.Text.Decode(b); err != nil {
			return fmt.Errorf("unable to decode sendMessageTextDraftAction#376d975c: field text: %w", err)
		}
	}
	return nil
}

// GetRandomID returns value of RandomID field.
func (s *SendMessageTextDraftAction) GetRandomID() (value int64) {
	if s == nil {
		return
	}
	return s.RandomID
}

// GetText returns value of Text field.
func (s *SendMessageTextDraftAction) GetText() (value TextWithEntities) {
	if s == nil {
		return
	}
	return s.Text
}

// SendMessageActionClassName is schema name of SendMessageActionClass.
const SendMessageActionClassName = "SendMessageAction"

// SendMessageActionClass represents SendMessageAction generic type.
//
// See https://core.telegram.org/type/SendMessageAction for reference.
//
// Example:
//
//	g, err := tg.DecodeSendMessageAction(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.SendMessageTypingAction: // sendMessageTypingAction#16bf744e
//	case *tg.SendMessageCancelAction: // sendMessageCancelAction#fd5ec8f5
//	case *tg.SendMessageRecordVideoAction: // sendMessageRecordVideoAction#a187d66f
//	case *tg.SendMessageUploadVideoAction: // sendMessageUploadVideoAction#e9763aec
//	case *tg.SendMessageRecordAudioAction: // sendMessageRecordAudioAction#d52f73f7
//	case *tg.SendMessageUploadAudioAction: // sendMessageUploadAudioAction#f351d7ab
//	case *tg.SendMessageUploadPhotoAction: // sendMessageUploadPhotoAction#d1d34a26
//	case *tg.SendMessageUploadDocumentAction: // sendMessageUploadDocumentAction#aa0cd9e4
//	case *tg.SendMessageGeoLocationAction: // sendMessageGeoLocationAction#176f8ba1
//	case *tg.SendMessageChooseContactAction: // sendMessageChooseContactAction#628cbc6f
//	case *tg.SendMessageGamePlayAction: // sendMessageGamePlayAction#dd6a8f48
//	case *tg.SendMessageRecordRoundAction: // sendMessageRecordRoundAction#88f27fbc
//	case *tg.SendMessageUploadRoundAction: // sendMessageUploadRoundAction#243e1c66
//	case *tg.SpeakingInGroupCallAction: // speakingInGroupCallAction#d92c2285
//	case *tg.SendMessageHistoryImportAction: // sendMessageHistoryImportAction#dbda9246
//	case *tg.SendMessageChooseStickerAction: // sendMessageChooseStickerAction#b05ac6b1
//	case *tg.SendMessageEmojiInteraction: // sendMessageEmojiInteraction#25972bcb
//	case *tg.SendMessageEmojiInteractionSeen: // sendMessageEmojiInteractionSeen#b665902e
//	case *tg.SendMessageTextDraftAction: // sendMessageTextDraftAction#376d975c
//	default: panic(v)
//	}
type SendMessageActionClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() SendMessageActionClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeSendMessageAction implements binary de-serialization for SendMessageActionClass.
func DecodeSendMessageAction(buf *bin.Buffer) (SendMessageActionClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case SendMessageTypingActionTypeID:
		// Decoding sendMessageTypingAction#16bf744e.
		v := SendMessageTypingAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageCancelActionTypeID:
		// Decoding sendMessageCancelAction#fd5ec8f5.
		v := SendMessageCancelAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageRecordVideoActionTypeID:
		// Decoding sendMessageRecordVideoAction#a187d66f.
		v := SendMessageRecordVideoAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageUploadVideoActionTypeID:
		// Decoding sendMessageUploadVideoAction#e9763aec.
		v := SendMessageUploadVideoAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageRecordAudioActionTypeID:
		// Decoding sendMessageRecordAudioAction#d52f73f7.
		v := SendMessageRecordAudioAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageUploadAudioActionTypeID:
		// Decoding sendMessageUploadAudioAction#f351d7ab.
		v := SendMessageUploadAudioAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageUploadPhotoActionTypeID:
		// Decoding sendMessageUploadPhotoAction#d1d34a26.
		v := SendMessageUploadPhotoAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageUploadDocumentActionTypeID:
		// Decoding sendMessageUploadDocumentAction#aa0cd9e4.
		v := SendMessageUploadDocumentAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageGeoLocationActionTypeID:
		// Decoding sendMessageGeoLocationAction#176f8ba1.
		v := SendMessageGeoLocationAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageChooseContactActionTypeID:
		// Decoding sendMessageChooseContactAction#628cbc6f.
		v := SendMessageChooseContactAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageGamePlayActionTypeID:
		// Decoding sendMessageGamePlayAction#dd6a8f48.
		v := SendMessageGamePlayAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageRecordRoundActionTypeID:
		// Decoding sendMessageRecordRoundAction#88f27fbc.
		v := SendMessageRecordRoundAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageUploadRoundActionTypeID:
		// Decoding sendMessageUploadRoundAction#243e1c66.
		v := SendMessageUploadRoundAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SpeakingInGroupCallActionTypeID:
		// Decoding speakingInGroupCallAction#d92c2285.
		v := SpeakingInGroupCallAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageHistoryImportActionTypeID:
		// Decoding sendMessageHistoryImportAction#dbda9246.
		v := SendMessageHistoryImportAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageChooseStickerActionTypeID:
		// Decoding sendMessageChooseStickerAction#b05ac6b1.
		v := SendMessageChooseStickerAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageEmojiInteractionTypeID:
		// Decoding sendMessageEmojiInteraction#25972bcb.
		v := SendMessageEmojiInteraction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageEmojiInteractionSeenTypeID:
		// Decoding sendMessageEmojiInteractionSeen#b665902e.
		v := SendMessageEmojiInteractionSeen{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	case SendMessageTextDraftActionTypeID:
		// Decoding sendMessageTextDraftAction#376d975c.
		v := SendMessageTextDraftAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode SendMessageActionClass: %w", bin.NewUnexpectedID(id))
	}
}

// SendMessageAction boxes the SendMessageActionClass providing a helper.
type SendMessageActionBox struct {
	SendMessageAction SendMessageActionClass
}

// Decode implements bin.Decoder for SendMessageActionBox.
func (b *SendMessageActionBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode SendMessageActionBox to nil")
	}
	v, err := DecodeSendMessageAction(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.SendMessageAction = v
	return nil
}

// Encode implements bin.Encode for SendMessageActionBox.
func (b *SendMessageActionBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.SendMessageAction == nil {
		return fmt.Errorf("unable to encode SendMessageActionClass as nil")
	}
	return b.SendMessageAction.Encode(buf)
}
