// Code generated by gotdgen, DO NOT EDIT.

package tg

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

	"go.uber.org/multierr"

	"github.com/gotd/td/bin"
	"github.com/gotd/td/tdjson"
	"github.com/gotd/td/tdp"
	"github.com/gotd/td/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{}
)

// MessageActionEmpty represents TL type `messageActionEmpty#b6aef7b0`.
// Empty constructor.
//
// See https://core.telegram.org/constructor/messageActionEmpty for reference.
type MessageActionEmpty struct {
}

// MessageActionEmptyTypeID is TL type id of MessageActionEmpty.
const MessageActionEmptyTypeID = 0xb6aef7b0

// construct implements constructor of MessageActionClass.
func (m MessageActionEmpty) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionEmpty{}
)

func (m *MessageActionEmpty) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionEmpty) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionEmpty#b6aef7b0 as nil")
	}
	b.PutID(MessageActionEmptyTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionEmpty) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionEmpty#b6aef7b0 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionEmpty) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionEmpty#b6aef7b0 to nil")
	}
	if err := b.ConsumeID(MessageActionEmptyTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionEmpty#b6aef7b0: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionEmpty) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionEmpty#b6aef7b0 to nil")
	}
	return nil
}

// MessageActionChatCreate represents TL type `messageActionChatCreate#bd47cbad`.
// Group created
//
// See https://core.telegram.org/constructor/messageActionChatCreate for reference.
type MessageActionChatCreate struct {
	// Group name
	Title string
	// List of group members
	Users []int64
}

// MessageActionChatCreateTypeID is TL type id of MessageActionChatCreate.
const MessageActionChatCreateTypeID = 0xbd47cbad

// construct implements constructor of MessageActionClass.
func (m MessageActionChatCreate) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatCreate{}
)

func (m *MessageActionChatCreate) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Title == "") {
		return false
	}
	if !(m.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatCreate from given interface.
func (m *MessageActionChatCreate) FillFrom(from interface {
	GetTitle() (value string)
	GetUsers() (value []int64)
}) {
	m.Title = from.GetTitle()
	m.Users = from.GetUsers()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatCreate) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatCreate",
		ID:   MessageActionChatCreateTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatCreate) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatCreate#bd47cbad as nil")
	}
	b.PutID(MessageActionChatCreateTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatCreate) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatCreate#bd47cbad as nil")
	}
	b.PutString(m.Title)
	b.PutVectorHeader(len(m.Users))
	for _, v := range m.Users {
		b.PutLong(v)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatCreate) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatCreate#bd47cbad to nil")
	}
	if err := b.ConsumeID(MessageActionChatCreateTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatCreate#bd47cbad: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatCreate) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatCreate#bd47cbad to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatCreate#bd47cbad: field title: %w", err)
		}
		m.Title = value
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatCreate#bd47cbad: field users: %w", err)
		}

		if headerLen > 0 {
			m.Users = make([]int64, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode messageActionChatCreate#bd47cbad: field users: %w", err)
			}
			m.Users = append(m.Users, value)
		}
	}
	return nil
}

// GetTitle returns value of Title field.
func (m *MessageActionChatCreate) GetTitle() (value string) {
	if m == nil {
		return
	}
	return m.Title
}

// GetUsers returns value of Users field.
func (m *MessageActionChatCreate) GetUsers() (value []int64) {
	if m == nil {
		return
	}
	return m.Users
}

// MessageActionChatEditTitle represents TL type `messageActionChatEditTitle#b5a1ce5a`.
// Group name changed.
//
// See https://core.telegram.org/constructor/messageActionChatEditTitle for reference.
type MessageActionChatEditTitle struct {
	// New group name
	Title string
}

// MessageActionChatEditTitleTypeID is TL type id of MessageActionChatEditTitle.
const MessageActionChatEditTitleTypeID = 0xb5a1ce5a

// construct implements constructor of MessageActionClass.
func (m MessageActionChatEditTitle) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatEditTitle{}
)

func (m *MessageActionChatEditTitle) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Title == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatEditTitle from given interface.
func (m *MessageActionChatEditTitle) FillFrom(from interface {
	GetTitle() (value string)
}) {
	m.Title = from.GetTitle()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatEditTitle) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatEditTitle",
		ID:   MessageActionChatEditTitleTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatEditTitle) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatEditTitle#b5a1ce5a as nil")
	}
	b.PutID(MessageActionChatEditTitleTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatEditTitle) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatEditTitle#b5a1ce5a as nil")
	}
	b.PutString(m.Title)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatEditTitle) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatEditTitle#b5a1ce5a to nil")
	}
	if err := b.ConsumeID(MessageActionChatEditTitleTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatEditTitle#b5a1ce5a: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatEditTitle) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatEditTitle#b5a1ce5a to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatEditTitle#b5a1ce5a: field title: %w", err)
		}
		m.Title = value
	}
	return nil
}

// GetTitle returns value of Title field.
func (m *MessageActionChatEditTitle) GetTitle() (value string) {
	if m == nil {
		return
	}
	return m.Title
}

// MessageActionChatEditPhoto represents TL type `messageActionChatEditPhoto#7fcb13a8`.
// Group profile changed
//
// See https://core.telegram.org/constructor/messageActionChatEditPhoto for reference.
type MessageActionChatEditPhoto struct {
	// New group profile photo
	Photo PhotoClass
}

// MessageActionChatEditPhotoTypeID is TL type id of MessageActionChatEditPhoto.
const MessageActionChatEditPhotoTypeID = 0x7fcb13a8

// construct implements constructor of MessageActionClass.
func (m MessageActionChatEditPhoto) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatEditPhoto{}
)

func (m *MessageActionChatEditPhoto) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Photo == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatEditPhoto from given interface.
func (m *MessageActionChatEditPhoto) FillFrom(from interface {
	GetPhoto() (value PhotoClass)
}) {
	m.Photo = from.GetPhoto()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatEditPhoto) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatEditPhoto",
		ID:   MessageActionChatEditPhotoTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Photo",
			SchemaName: "photo",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatEditPhoto) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatEditPhoto#7fcb13a8 as nil")
	}
	b.PutID(MessageActionChatEditPhotoTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatEditPhoto) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatEditPhoto#7fcb13a8 as nil")
	}
	if m.Photo == nil {
		return fmt.Errorf("unable to encode messageActionChatEditPhoto#7fcb13a8: field photo is nil")
	}
	if err := m.Photo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionChatEditPhoto#7fcb13a8: field photo: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatEditPhoto) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatEditPhoto#7fcb13a8 to nil")
	}
	if err := b.ConsumeID(MessageActionChatEditPhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatEditPhoto#7fcb13a8: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatEditPhoto) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatEditPhoto#7fcb13a8 to nil")
	}
	{
		value, err := DecodePhoto(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatEditPhoto#7fcb13a8: field photo: %w", err)
		}
		m.Photo = value
	}
	return nil
}

// GetPhoto returns value of Photo field.
func (m *MessageActionChatEditPhoto) GetPhoto() (value PhotoClass) {
	if m == nil {
		return
	}
	return m.Photo
}

// MessageActionChatDeletePhoto represents TL type `messageActionChatDeletePhoto#95e3fbef`.
// Group profile photo removed.
//
// See https://core.telegram.org/constructor/messageActionChatDeletePhoto for reference.
type MessageActionChatDeletePhoto struct {
}

// MessageActionChatDeletePhotoTypeID is TL type id of MessageActionChatDeletePhoto.
const MessageActionChatDeletePhotoTypeID = 0x95e3fbef

// construct implements constructor of MessageActionClass.
func (m MessageActionChatDeletePhoto) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatDeletePhoto{}
)

func (m *MessageActionChatDeletePhoto) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionChatDeletePhoto) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatDeletePhoto#95e3fbef as nil")
	}
	b.PutID(MessageActionChatDeletePhotoTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatDeletePhoto) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatDeletePhoto#95e3fbef as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatDeletePhoto) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatDeletePhoto#95e3fbef to nil")
	}
	if err := b.ConsumeID(MessageActionChatDeletePhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatDeletePhoto#95e3fbef: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatDeletePhoto) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatDeletePhoto#95e3fbef to nil")
	}
	return nil
}

// MessageActionChatAddUser represents TL type `messageActionChatAddUser#15cefd00`.
// New member in the group
//
// See https://core.telegram.org/constructor/messageActionChatAddUser for reference.
type MessageActionChatAddUser struct {
	// Users that were invited to the chat
	Users []int64
}

// MessageActionChatAddUserTypeID is TL type id of MessageActionChatAddUser.
const MessageActionChatAddUserTypeID = 0x15cefd00

// construct implements constructor of MessageActionClass.
func (m MessageActionChatAddUser) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatAddUser{}
)

func (m *MessageActionChatAddUser) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatAddUser from given interface.
func (m *MessageActionChatAddUser) FillFrom(from interface {
	GetUsers() (value []int64)
}) {
	m.Users = from.GetUsers()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatAddUser) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatAddUser",
		ID:   MessageActionChatAddUserTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatAddUser) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatAddUser#15cefd00 as nil")
	}
	b.PutID(MessageActionChatAddUserTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatAddUser) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatAddUser#15cefd00 as nil")
	}
	b.PutVectorHeader(len(m.Users))
	for _, v := range m.Users {
		b.PutLong(v)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatAddUser) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatAddUser#15cefd00 to nil")
	}
	if err := b.ConsumeID(MessageActionChatAddUserTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatAddUser#15cefd00: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatAddUser) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatAddUser#15cefd00 to nil")
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatAddUser#15cefd00: field users: %w", err)
		}

		if headerLen > 0 {
			m.Users = make([]int64, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode messageActionChatAddUser#15cefd00: field users: %w", err)
			}
			m.Users = append(m.Users, value)
		}
	}
	return nil
}

// GetUsers returns value of Users field.
func (m *MessageActionChatAddUser) GetUsers() (value []int64) {
	if m == nil {
		return
	}
	return m.Users
}

// MessageActionChatDeleteUser represents TL type `messageActionChatDeleteUser#a43f30cc`.
// User left the group.
//
// See https://core.telegram.org/constructor/messageActionChatDeleteUser for reference.
type MessageActionChatDeleteUser struct {
	// Leaving user ID
	UserID int64
}

// MessageActionChatDeleteUserTypeID is TL type id of MessageActionChatDeleteUser.
const MessageActionChatDeleteUserTypeID = 0xa43f30cc

// construct implements constructor of MessageActionClass.
func (m MessageActionChatDeleteUser) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatDeleteUser{}
)

func (m *MessageActionChatDeleteUser) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.UserID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatDeleteUser from given interface.
func (m *MessageActionChatDeleteUser) FillFrom(from interface {
	GetUserID() (value int64)
}) {
	m.UserID = from.GetUserID()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatDeleteUser) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatDeleteUser",
		ID:   MessageActionChatDeleteUserTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatDeleteUser) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatDeleteUser#a43f30cc as nil")
	}
	b.PutID(MessageActionChatDeleteUserTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatDeleteUser) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatDeleteUser#a43f30cc as nil")
	}
	b.PutLong(m.UserID)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatDeleteUser) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatDeleteUser#a43f30cc to nil")
	}
	if err := b.ConsumeID(MessageActionChatDeleteUserTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatDeleteUser#a43f30cc: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatDeleteUser) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatDeleteUser#a43f30cc to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatDeleteUser#a43f30cc: field user_id: %w", err)
		}
		m.UserID = value
	}
	return nil
}

// GetUserID returns value of UserID field.
func (m *MessageActionChatDeleteUser) GetUserID() (value int64) {
	if m == nil {
		return
	}
	return m.UserID
}

// MessageActionChatJoinedByLink represents TL type `messageActionChatJoinedByLink#31224c3`.
// A user joined the chat via an invite link
//
// See https://core.telegram.org/constructor/messageActionChatJoinedByLink for reference.
type MessageActionChatJoinedByLink struct {
	// ID of the user that created the invite link
	InviterID int64
}

// MessageActionChatJoinedByLinkTypeID is TL type id of MessageActionChatJoinedByLink.
const MessageActionChatJoinedByLinkTypeID = 0x31224c3

// construct implements constructor of MessageActionClass.
func (m MessageActionChatJoinedByLink) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatJoinedByLink{}
)

func (m *MessageActionChatJoinedByLink) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.InviterID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatJoinedByLink from given interface.
func (m *MessageActionChatJoinedByLink) FillFrom(from interface {
	GetInviterID() (value int64)
}) {
	m.InviterID = from.GetInviterID()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatJoinedByLink) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatJoinedByLink",
		ID:   MessageActionChatJoinedByLinkTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviterID",
			SchemaName: "inviter_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatJoinedByLink) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatJoinedByLink#31224c3 as nil")
	}
	b.PutID(MessageActionChatJoinedByLinkTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatJoinedByLink) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatJoinedByLink#31224c3 as nil")
	}
	b.PutLong(m.InviterID)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatJoinedByLink) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatJoinedByLink#31224c3 to nil")
	}
	if err := b.ConsumeID(MessageActionChatJoinedByLinkTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatJoinedByLink#31224c3: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatJoinedByLink) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatJoinedByLink#31224c3 to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatJoinedByLink#31224c3: field inviter_id: %w", err)
		}
		m.InviterID = value
	}
	return nil
}

// GetInviterID returns value of InviterID field.
func (m *MessageActionChatJoinedByLink) GetInviterID() (value int64) {
	if m == nil {
		return
	}
	return m.InviterID
}

// MessageActionChannelCreate represents TL type `messageActionChannelCreate#95d2ac92`.
// The channel was created
//
// See https://core.telegram.org/constructor/messageActionChannelCreate for reference.
type MessageActionChannelCreate struct {
	// Original channel/supergroup title
	Title string
}

// MessageActionChannelCreateTypeID is TL type id of MessageActionChannelCreate.
const MessageActionChannelCreateTypeID = 0x95d2ac92

// construct implements constructor of MessageActionClass.
func (m MessageActionChannelCreate) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChannelCreate{}
)

func (m *MessageActionChannelCreate) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Title == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChannelCreate from given interface.
func (m *MessageActionChannelCreate) FillFrom(from interface {
	GetTitle() (value string)
}) {
	m.Title = from.GetTitle()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChannelCreate) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChannelCreate",
		ID:   MessageActionChannelCreateTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChannelCreate) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChannelCreate#95d2ac92 as nil")
	}
	b.PutID(MessageActionChannelCreateTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChannelCreate) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChannelCreate#95d2ac92 as nil")
	}
	b.PutString(m.Title)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChannelCreate) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChannelCreate#95d2ac92 to nil")
	}
	if err := b.ConsumeID(MessageActionChannelCreateTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChannelCreate#95d2ac92: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChannelCreate) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChannelCreate#95d2ac92 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChannelCreate#95d2ac92: field title: %w", err)
		}
		m.Title = value
	}
	return nil
}

// GetTitle returns value of Title field.
func (m *MessageActionChannelCreate) GetTitle() (value string) {
	if m == nil {
		return
	}
	return m.Title
}

// MessageActionChatMigrateTo represents TL type `messageActionChatMigrateTo#e1037f92`.
// Indicates the chat was migrated¹ to the specified supergroup
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/messageActionChatMigrateTo for reference.
type MessageActionChatMigrateTo struct {
	// The supergroup it was migrated to
	ChannelID int64
}

// MessageActionChatMigrateToTypeID is TL type id of MessageActionChatMigrateTo.
const MessageActionChatMigrateToTypeID = 0xe1037f92

// construct implements constructor of MessageActionClass.
func (m MessageActionChatMigrateTo) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatMigrateTo{}
)

func (m *MessageActionChatMigrateTo) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.ChannelID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChatMigrateTo from given interface.
func (m *MessageActionChatMigrateTo) FillFrom(from interface {
	GetChannelID() (value int64)
}) {
	m.ChannelID = from.GetChannelID()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChatMigrateTo) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChatMigrateTo",
		ID:   MessageActionChatMigrateToTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ChannelID",
			SchemaName: "channel_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChatMigrateTo) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatMigrateTo#e1037f92 as nil")
	}
	b.PutID(MessageActionChatMigrateToTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatMigrateTo) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatMigrateTo#e1037f92 as nil")
	}
	b.PutLong(m.ChannelID)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatMigrateTo) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatMigrateTo#e1037f92 to nil")
	}
	if err := b.ConsumeID(MessageActionChatMigrateToTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatMigrateTo#e1037f92: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatMigrateTo) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatMigrateTo#e1037f92 to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChatMigrateTo#e1037f92: field channel_id: %w", err)
		}
		m.ChannelID = value
	}
	return nil
}

// GetChannelID returns value of ChannelID field.
func (m *MessageActionChatMigrateTo) GetChannelID() (value int64) {
	if m == nil {
		return
	}
	return m.ChannelID
}

// MessageActionChannelMigrateFrom represents TL type `messageActionChannelMigrateFrom#ea3948e9`.
// Indicates the channel was migrated¹ from the specified chat
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/constructor/messageActionChannelMigrateFrom for reference.
type MessageActionChannelMigrateFrom struct {
	// The old chat title
	Title string
	// The old chat ID
	ChatID int64
}

// MessageActionChannelMigrateFromTypeID is TL type id of MessageActionChannelMigrateFrom.
const MessageActionChannelMigrateFromTypeID = 0xea3948e9

// construct implements constructor of MessageActionClass.
func (m MessageActionChannelMigrateFrom) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChannelMigrateFrom{}
)

func (m *MessageActionChannelMigrateFrom) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Title == "") {
		return false
	}
	if !(m.ChatID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionChannelMigrateFrom from given interface.
func (m *MessageActionChannelMigrateFrom) FillFrom(from interface {
	GetTitle() (value string)
	GetChatID() (value int64)
}) {
	m.Title = from.GetTitle()
	m.ChatID = from.GetChatID()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionChannelMigrateFrom) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionChannelMigrateFrom",
		ID:   MessageActionChannelMigrateFromTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "ChatID",
			SchemaName: "chat_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionChannelMigrateFrom) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChannelMigrateFrom#ea3948e9 as nil")
	}
	b.PutID(MessageActionChannelMigrateFromTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChannelMigrateFrom) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChannelMigrateFrom#ea3948e9 as nil")
	}
	b.PutString(m.Title)
	b.PutLong(m.ChatID)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChannelMigrateFrom) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChannelMigrateFrom#ea3948e9 to nil")
	}
	if err := b.ConsumeID(MessageActionChannelMigrateFromTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChannelMigrateFrom#ea3948e9: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChannelMigrateFrom) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChannelMigrateFrom#ea3948e9 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChannelMigrateFrom#ea3948e9: field title: %w", err)
		}
		m.Title = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionChannelMigrateFrom#ea3948e9: field chat_id: %w", err)
		}
		m.ChatID = value
	}
	return nil
}

// GetTitle returns value of Title field.
func (m *MessageActionChannelMigrateFrom) GetTitle() (value string) {
	if m == nil {
		return
	}
	return m.Title
}

// GetChatID returns value of ChatID field.
func (m *MessageActionChannelMigrateFrom) GetChatID() (value int64) {
	if m == nil {
		return
	}
	return m.ChatID
}

// MessageActionPinMessage represents TL type `messageActionPinMessage#94bd38ed`.
// A message was pinned
//
// See https://core.telegram.org/constructor/messageActionPinMessage for reference.
type MessageActionPinMessage struct {
}

// MessageActionPinMessageTypeID is TL type id of MessageActionPinMessage.
const MessageActionPinMessageTypeID = 0x94bd38ed

// construct implements constructor of MessageActionClass.
func (m MessageActionPinMessage) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionPinMessage{}
)

func (m *MessageActionPinMessage) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionPinMessage) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPinMessage#94bd38ed as nil")
	}
	b.PutID(MessageActionPinMessageTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionPinMessage) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPinMessage#94bd38ed as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionPinMessage) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPinMessage#94bd38ed to nil")
	}
	if err := b.ConsumeID(MessageActionPinMessageTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionPinMessage#94bd38ed: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionPinMessage) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPinMessage#94bd38ed to nil")
	}
	return nil
}

// MessageActionHistoryClear represents TL type `messageActionHistoryClear#9fbab604`.
// Chat history was cleared
//
// See https://core.telegram.org/constructor/messageActionHistoryClear for reference.
type MessageActionHistoryClear struct {
}

// MessageActionHistoryClearTypeID is TL type id of MessageActionHistoryClear.
const MessageActionHistoryClearTypeID = 0x9fbab604

// construct implements constructor of MessageActionClass.
func (m MessageActionHistoryClear) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionHistoryClear{}
)

func (m *MessageActionHistoryClear) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionHistoryClear) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionHistoryClear#9fbab604 as nil")
	}
	b.PutID(MessageActionHistoryClearTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionHistoryClear) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionHistoryClear#9fbab604 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionHistoryClear) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionHistoryClear#9fbab604 to nil")
	}
	if err := b.ConsumeID(MessageActionHistoryClearTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionHistoryClear#9fbab604: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionHistoryClear) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionHistoryClear#9fbab604 to nil")
	}
	return nil
}

// MessageActionGameScore represents TL type `messageActionGameScore#92a72876`.
// Someone scored in a game
//
// See https://core.telegram.org/constructor/messageActionGameScore for reference.
type MessageActionGameScore struct {
	// Game ID
	GameID int64
	// Score
	Score int
}

// MessageActionGameScoreTypeID is TL type id of MessageActionGameScore.
const MessageActionGameScoreTypeID = 0x92a72876

// construct implements constructor of MessageActionClass.
func (m MessageActionGameScore) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionGameScore{}
)

func (m *MessageActionGameScore) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.GameID == 0) {
		return false
	}
	if !(m.Score == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionGameScore from given interface.
func (m *MessageActionGameScore) FillFrom(from interface {
	GetGameID() (value int64)
	GetScore() (value int)
}) {
	m.GameID = from.GetGameID()
	m.Score = from.GetScore()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionGameScore) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionGameScore",
		ID:   MessageActionGameScoreTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "GameID",
			SchemaName: "game_id",
		},
		{
			Name:       "Score",
			SchemaName: "score",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionGameScore) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGameScore#92a72876 as nil")
	}
	b.PutID(MessageActionGameScoreTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionGameScore) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGameScore#92a72876 as nil")
	}
	b.PutLong(m.GameID)
	b.PutInt(m.Score)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionGameScore) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGameScore#92a72876 to nil")
	}
	if err := b.ConsumeID(MessageActionGameScoreTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionGameScore#92a72876: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionGameScore) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGameScore#92a72876 to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGameScore#92a72876: field game_id: %w", err)
		}
		m.GameID = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGameScore#92a72876: field score: %w", err)
		}
		m.Score = value
	}
	return nil
}

// GetGameID returns value of GameID field.
func (m *MessageActionGameScore) GetGameID() (value int64) {
	if m == nil {
		return
	}
	return m.GameID
}

// GetScore returns value of Score field.
func (m *MessageActionGameScore) GetScore() (value int) {
	if m == nil {
		return
	}
	return m.Score
}

// MessageActionPaymentSentMe represents TL type `messageActionPaymentSentMe#8f31b327`.
// A user just sent a payment to me (a bot)
//
// See https://core.telegram.org/constructor/messageActionPaymentSentMe for reference.
type MessageActionPaymentSentMe struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this is the first payment of a recurring payment we just subscribed to
	RecurringInit bool
	// Whether this payment is part of a recurring payment
	RecurringUsed bool
	// Three-letter ISO 4217 currency¹ code
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments#supported-currencies
	Currency string
	// Price of the product in the smallest units of the currency (integer, not float/double)
	// For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
	// currencies.json¹, it shows the number of digits past the decimal point for each
	// currency (2 for the majority of currencies).
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int64
	// Bot specified invoice payload
	Payload []byte
	// Order info provided by the user
	//
	// Use SetInfo and GetInfo helpers.
	Info PaymentRequestedInfo
	// Identifier of the shipping option chosen by the user
	//
	// Use SetShippingOptionID and GetShippingOptionID helpers.
	ShippingOptionID string
	// Provider payment identifier
	Charge PaymentCharge
}

// MessageActionPaymentSentMeTypeID is TL type id of MessageActionPaymentSentMe.
const MessageActionPaymentSentMeTypeID = 0x8f31b327

// construct implements constructor of MessageActionClass.
func (m MessageActionPaymentSentMe) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionPaymentSentMe{}
)

func (m *MessageActionPaymentSentMe) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.RecurringInit == false) {
		return false
	}
	if !(m.RecurringUsed == false) {
		return false
	}
	if !(m.Currency == "") {
		return false
	}
	if !(m.TotalAmount == 0) {
		return false
	}
	if !(m.Payload == nil) {
		return false
	}
	if !(m.Info.Zero()) {
		return false
	}
	if !(m.ShippingOptionID == "") {
		return false
	}
	if !(m.Charge.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionPaymentSentMe from given interface.
func (m *MessageActionPaymentSentMe) FillFrom(from interface {
	GetRecurringInit() (value bool)
	GetRecurringUsed() (value bool)
	GetCurrency() (value string)
	GetTotalAmount() (value int64)
	GetPayload() (value []byte)
	GetInfo() (value PaymentRequestedInfo, ok bool)
	GetShippingOptionID() (value string, ok bool)
	GetCharge() (value PaymentCharge)
}) {
	m.RecurringInit = from.GetRecurringInit()
	m.RecurringUsed = from.GetRecurringUsed()
	m.Currency = from.GetCurrency()
	m.TotalAmount = from.GetTotalAmount()
	m.Payload = from.GetPayload()
	if val, ok := from.GetInfo(); ok {
		m.Info = val
	}

	if val, ok := from.GetShippingOptionID(); ok {
		m.ShippingOptionID = val
	}

	m.Charge = from.GetCharge()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionPaymentSentMe) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionPaymentSentMe",
		ID:   MessageActionPaymentSentMeTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "RecurringInit",
			SchemaName: "recurring_init",
			Null:       !m.Flags.Has(2),
		},
		{
			Name:       "RecurringUsed",
			SchemaName: "recurring_used",
			Null:       !m.Flags.Has(3),
		},
		{
			Name:       "Currency",
			SchemaName: "currency",
		},
		{
			Name:       "TotalAmount",
			SchemaName: "total_amount",
		},
		{
			Name:       "Payload",
			SchemaName: "payload",
		},
		{
			Name:       "Info",
			SchemaName: "info",
			Null:       !m.Flags.Has(0),
		},
		{
			Name:       "ShippingOptionID",
			SchemaName: "shipping_option_id",
			Null:       !m.Flags.Has(1),
		},
		{
			Name:       "Charge",
			SchemaName: "charge",
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionPaymentSentMe) SetFlags() {
	if !(m.RecurringInit == false) {
		m.Flags.Set(2)
	}
	if !(m.RecurringUsed == false) {
		m.Flags.Set(3)
	}
	if !(m.Info.Zero()) {
		m.Flags.Set(0)
	}
	if !(m.ShippingOptionID == "") {
		m.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionPaymentSentMe) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPaymentSentMe#8f31b327 as nil")
	}
	b.PutID(MessageActionPaymentSentMeTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionPaymentSentMe) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPaymentSentMe#8f31b327 as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionPaymentSentMe#8f31b327: field flags: %w", err)
	}
	b.PutString(m.Currency)
	b.PutLong(m.TotalAmount)
	b.PutBytes(m.Payload)
	if m.Flags.Has(0) {
		if err := m.Info.Encode(b); err != nil {
			return fmt.Errorf("unable to encode messageActionPaymentSentMe#8f31b327: field info: %w", err)
		}
	}
	if m.Flags.Has(1) {
		b.PutString(m.ShippingOptionID)
	}
	if err := m.Charge.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionPaymentSentMe#8f31b327: field charge: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionPaymentSentMe) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPaymentSentMe#8f31b327 to nil")
	}
	if err := b.ConsumeID(MessageActionPaymentSentMeTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionPaymentSentMe) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPaymentSentMe#8f31b327 to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field flags: %w", err)
		}
	}
	m.RecurringInit = m.Flags.Has(2)
	m.RecurringUsed = m.Flags.Has(3)
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field currency: %w", err)
		}
		m.Currency = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field total_amount: %w", err)
		}
		m.TotalAmount = value
	}
	{
		value, err := b.Bytes()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field payload: %w", err)
		}
		m.Payload = value
	}
	if m.Flags.Has(0) {
		if err := m.Info.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field info: %w", err)
		}
	}
	if m.Flags.Has(1) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field shipping_option_id: %w", err)
		}
		m.ShippingOptionID = value
	}
	{
		if err := m.Charge.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSentMe#8f31b327: field charge: %w", err)
		}
	}
	return nil
}

// SetRecurringInit sets value of RecurringInit conditional field.
func (m *MessageActionPaymentSentMe) SetRecurringInit(value bool) {
	if value {
		m.Flags.Set(2)
		m.RecurringInit = true
	} else {
		m.Flags.Unset(2)
		m.RecurringInit = false
	}
}

// GetRecurringInit returns value of RecurringInit conditional field.
func (m *MessageActionPaymentSentMe) GetRecurringInit() (value bool) {
	if m == nil {
		return
	}
	return m.Flags.Has(2)
}

// SetRecurringUsed sets value of RecurringUsed conditional field.
func (m *MessageActionPaymentSentMe) SetRecurringUsed(value bool) {
	if value {
		m.Flags.Set(3)
		m.RecurringUsed = true
	} else {
		m.Flags.Unset(3)
		m.RecurringUsed = false
	}
}

// GetRecurringUsed returns value of RecurringUsed conditional field.
func (m *MessageActionPaymentSentMe) GetRecurringUsed() (value bool) {
	if m == nil {
		return
	}
	return m.Flags.Has(3)
}

// GetCurrency returns value of Currency field.
func (m *MessageActionPaymentSentMe) GetCurrency() (value string) {
	if m == nil {
		return
	}
	return m.Currency
}

// GetTotalAmount returns value of TotalAmount field.
func (m *MessageActionPaymentSentMe) GetTotalAmount() (value int64) {
	if m == nil {
		return
	}
	return m.TotalAmount
}

// GetPayload returns value of Payload field.
func (m *MessageActionPaymentSentMe) GetPayload() (value []byte) {
	if m == nil {
		return
	}
	return m.Payload
}

// SetInfo sets value of Info conditional field.
func (m *MessageActionPaymentSentMe) SetInfo(value PaymentRequestedInfo) {
	m.Flags.Set(0)
	m.Info = value
}

// GetInfo returns value of Info conditional field and
// boolean which is true if field was set.
func (m *MessageActionPaymentSentMe) GetInfo() (value PaymentRequestedInfo, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.Info, true
}

// SetShippingOptionID sets value of ShippingOptionID conditional field.
func (m *MessageActionPaymentSentMe) SetShippingOptionID(value string) {
	m.Flags.Set(1)
	m.ShippingOptionID = value
}

// GetShippingOptionID returns value of ShippingOptionID conditional field and
// boolean which is true if field was set.
func (m *MessageActionPaymentSentMe) GetShippingOptionID() (value string, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(1) {
		return value, false
	}
	return m.ShippingOptionID, true
}

// GetCharge returns value of Charge field.
func (m *MessageActionPaymentSentMe) GetCharge() (value PaymentCharge) {
	if m == nil {
		return
	}
	return m.Charge
}

// MessageActionPaymentSent represents TL type `messageActionPaymentSent#96163f56`.
// A payment was sent
//
// See https://core.telegram.org/constructor/messageActionPaymentSent for reference.
type MessageActionPaymentSent struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this is the first payment of a recurring payment we just subscribed to
	RecurringInit bool
	// Whether this payment is part of a recurring payment
	RecurringUsed bool
	// Three-letter ISO 4217 currency¹ code
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments#supported-currencies
	Currency string
	// Price of the product in the smallest units of the currency (integer, not float/double)
	// For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
	// currencies.json¹, it shows the number of digits past the decimal point for each
	// currency (2 for the majority of currencies).
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int64
	// An invoice slug taken from an invoice deep link¹ or from the premium_invoice_slug app
	// config parameter »²
	//
	// Links:
	//  1) https://core.telegram.org/api/links#invoice-links
	//  2) https://core.telegram.org/api/config#premium-invoice-slug
	//
	// Use SetInvoiceSlug and GetInvoiceSlug helpers.
	InvoiceSlug string
}

// MessageActionPaymentSentTypeID is TL type id of MessageActionPaymentSent.
const MessageActionPaymentSentTypeID = 0x96163f56

// construct implements constructor of MessageActionClass.
func (m MessageActionPaymentSent) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionPaymentSent{}
)

func (m *MessageActionPaymentSent) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.RecurringInit == false) {
		return false
	}
	if !(m.RecurringUsed == false) {
		return false
	}
	if !(m.Currency == "") {
		return false
	}
	if !(m.TotalAmount == 0) {
		return false
	}
	if !(m.InvoiceSlug == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionPaymentSent from given interface.
func (m *MessageActionPaymentSent) FillFrom(from interface {
	GetRecurringInit() (value bool)
	GetRecurringUsed() (value bool)
	GetCurrency() (value string)
	GetTotalAmount() (value int64)
	GetInvoiceSlug() (value string, ok bool)
}) {
	m.RecurringInit = from.GetRecurringInit()
	m.RecurringUsed = from.GetRecurringUsed()
	m.Currency = from.GetCurrency()
	m.TotalAmount = from.GetTotalAmount()
	if val, ok := from.GetInvoiceSlug(); ok {
		m.InvoiceSlug = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionPaymentSent) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionPaymentSent",
		ID:   MessageActionPaymentSentTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "RecurringInit",
			SchemaName: "recurring_init",
			Null:       !m.Flags.Has(2),
		},
		{
			Name:       "RecurringUsed",
			SchemaName: "recurring_used",
			Null:       !m.Flags.Has(3),
		},
		{
			Name:       "Currency",
			SchemaName: "currency",
		},
		{
			Name:       "TotalAmount",
			SchemaName: "total_amount",
		},
		{
			Name:       "InvoiceSlug",
			SchemaName: "invoice_slug",
			Null:       !m.Flags.Has(0),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionPaymentSent) SetFlags() {
	if !(m.RecurringInit == false) {
		m.Flags.Set(2)
	}
	if !(m.RecurringUsed == false) {
		m.Flags.Set(3)
	}
	if !(m.InvoiceSlug == "") {
		m.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionPaymentSent) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPaymentSent#96163f56 as nil")
	}
	b.PutID(MessageActionPaymentSentTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionPaymentSent) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPaymentSent#96163f56 as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionPaymentSent#96163f56: field flags: %w", err)
	}
	b.PutString(m.Currency)
	b.PutLong(m.TotalAmount)
	if m.Flags.Has(0) {
		b.PutString(m.InvoiceSlug)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionPaymentSent) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPaymentSent#96163f56 to nil")
	}
	if err := b.ConsumeID(MessageActionPaymentSentTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionPaymentSent#96163f56: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionPaymentSent) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPaymentSent#96163f56 to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSent#96163f56: field flags: %w", err)
		}
	}
	m.RecurringInit = m.Flags.Has(2)
	m.RecurringUsed = m.Flags.Has(3)
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSent#96163f56: field currency: %w", err)
		}
		m.Currency = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSent#96163f56: field total_amount: %w", err)
		}
		m.TotalAmount = value
	}
	if m.Flags.Has(0) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPaymentSent#96163f56: field invoice_slug: %w", err)
		}
		m.InvoiceSlug = value
	}
	return nil
}

// SetRecurringInit sets value of RecurringInit conditional field.
func (m *MessageActionPaymentSent) SetRecurringInit(value bool) {
	if value {
		m.Flags.Set(2)
		m.RecurringInit = true
	} else {
		m.Flags.Unset(2)
		m.RecurringInit = false
	}
}

// GetRecurringInit returns value of RecurringInit conditional field.
func (m *MessageActionPaymentSent) GetRecurringInit() (value bool) {
	if m == nil {
		return
	}
	return m.Flags.Has(2)
}

// SetRecurringUsed sets value of RecurringUsed conditional field.
func (m *MessageActionPaymentSent) SetRecurringUsed(value bool) {
	if value {
		m.Flags.Set(3)
		m.RecurringUsed = true
	} else {
		m.Flags.Unset(3)
		m.RecurringUsed = false
	}
}

// GetRecurringUsed returns value of RecurringUsed conditional field.
func (m *MessageActionPaymentSent) GetRecurringUsed() (value bool) {
	if m == nil {
		return
	}
	return m.Flags.Has(3)
}

// GetCurrency returns value of Currency field.
func (m *MessageActionPaymentSent) GetCurrency() (value string) {
	if m == nil {
		return
	}
	return m.Currency
}

// GetTotalAmount returns value of TotalAmount field.
func (m *MessageActionPaymentSent) GetTotalAmount() (value int64) {
	if m == nil {
		return
	}
	return m.TotalAmount
}

// SetInvoiceSlug sets value of InvoiceSlug conditional field.
func (m *MessageActionPaymentSent) SetInvoiceSlug(value string) {
	m.Flags.Set(0)
	m.InvoiceSlug = value
}

// GetInvoiceSlug returns value of InvoiceSlug conditional field and
// boolean which is true if field was set.
func (m *MessageActionPaymentSent) GetInvoiceSlug() (value string, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.InvoiceSlug, true
}

// MessageActionPhoneCall represents TL type `messageActionPhoneCall#80e11a7f`.
// A phone call
//
// See https://core.telegram.org/constructor/messageActionPhoneCall for reference.
type MessageActionPhoneCall struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Is this a video call?
	Video bool
	// Call ID
	CallID int64
	// If the call has ended, the reason why it ended
	//
	// Use SetReason and GetReason helpers.
	Reason PhoneCallDiscardReasonClass
	// Duration of the call in seconds
	//
	// Use SetDuration and GetDuration helpers.
	Duration int
}

// MessageActionPhoneCallTypeID is TL type id of MessageActionPhoneCall.
const MessageActionPhoneCallTypeID = 0x80e11a7f

// construct implements constructor of MessageActionClass.
func (m MessageActionPhoneCall) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionPhoneCall{}
)

func (m *MessageActionPhoneCall) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.Video == false) {
		return false
	}
	if !(m.CallID == 0) {
		return false
	}
	if !(m.Reason == nil) {
		return false
	}
	if !(m.Duration == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionPhoneCall from given interface.
func (m *MessageActionPhoneCall) FillFrom(from interface {
	GetVideo() (value bool)
	GetCallID() (value int64)
	GetReason() (value PhoneCallDiscardReasonClass, ok bool)
	GetDuration() (value int, ok bool)
}) {
	m.Video = from.GetVideo()
	m.CallID = from.GetCallID()
	if val, ok := from.GetReason(); ok {
		m.Reason = val
	}

	if val, ok := from.GetDuration(); ok {
		m.Duration = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionPhoneCall) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionPhoneCall",
		ID:   MessageActionPhoneCallTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Video",
			SchemaName: "video",
			Null:       !m.Flags.Has(2),
		},
		{
			Name:       "CallID",
			SchemaName: "call_id",
		},
		{
			Name:       "Reason",
			SchemaName: "reason",
			Null:       !m.Flags.Has(0),
		},
		{
			Name:       "Duration",
			SchemaName: "duration",
			Null:       !m.Flags.Has(1),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionPhoneCall) SetFlags() {
	if !(m.Video == false) {
		m.Flags.Set(2)
	}
	if !(m.Reason == nil) {
		m.Flags.Set(0)
	}
	if !(m.Duration == 0) {
		m.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionPhoneCall) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPhoneCall#80e11a7f as nil")
	}
	b.PutID(MessageActionPhoneCallTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionPhoneCall) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionPhoneCall#80e11a7f as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionPhoneCall#80e11a7f: field flags: %w", err)
	}
	b.PutLong(m.CallID)
	if m.Flags.Has(0) {
		if m.Reason == nil {
			return fmt.Errorf("unable to encode messageActionPhoneCall#80e11a7f: field reason is nil")
		}
		if err := m.Reason.Encode(b); err != nil {
			return fmt.Errorf("unable to encode messageActionPhoneCall#80e11a7f: field reason: %w", err)
		}
	}
	if m.Flags.Has(1) {
		b.PutInt(m.Duration)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionPhoneCall) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPhoneCall#80e11a7f to nil")
	}
	if err := b.ConsumeID(MessageActionPhoneCallTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionPhoneCall#80e11a7f: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionPhoneCall) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionPhoneCall#80e11a7f to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionPhoneCall#80e11a7f: field flags: %w", err)
		}
	}
	m.Video = m.Flags.Has(2)
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPhoneCall#80e11a7f: field call_id: %w", err)
		}
		m.CallID = value
	}
	if m.Flags.Has(0) {
		value, err := DecodePhoneCallDiscardReason(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPhoneCall#80e11a7f: field reason: %w", err)
		}
		m.Reason = value
	}
	if m.Flags.Has(1) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionPhoneCall#80e11a7f: field duration: %w", err)
		}
		m.Duration = value
	}
	return nil
}

// SetVideo sets value of Video conditional field.
func (m *MessageActionPhoneCall) SetVideo(value bool) {
	if value {
		m.Flags.Set(2)
		m.Video = true
	} else {
		m.Flags.Unset(2)
		m.Video = false
	}
}

// GetVideo returns value of Video conditional field.
func (m *MessageActionPhoneCall) GetVideo() (value bool) {
	if m == nil {
		return
	}
	return m.Flags.Has(2)
}

// GetCallID returns value of CallID field.
func (m *MessageActionPhoneCall) GetCallID() (value int64) {
	if m == nil {
		return
	}
	return m.CallID
}

// SetReason sets value of Reason conditional field.
func (m *MessageActionPhoneCall) SetReason(value PhoneCallDiscardReasonClass) {
	m.Flags.Set(0)
	m.Reason = value
}

// GetReason returns value of Reason conditional field and
// boolean which is true if field was set.
func (m *MessageActionPhoneCall) GetReason() (value PhoneCallDiscardReasonClass, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.Reason, true
}

// SetDuration sets value of Duration conditional field.
func (m *MessageActionPhoneCall) SetDuration(value int) {
	m.Flags.Set(1)
	m.Duration = value
}

// GetDuration returns value of Duration conditional field and
// boolean which is true if field was set.
func (m *MessageActionPhoneCall) GetDuration() (value int, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(1) {
		return value, false
	}
	return m.Duration, true
}

// MessageActionScreenshotTaken represents TL type `messageActionScreenshotTaken#4792929b`.
// A screenshot of the chat was taken
//
// See https://core.telegram.org/constructor/messageActionScreenshotTaken for reference.
type MessageActionScreenshotTaken struct {
}

// MessageActionScreenshotTakenTypeID is TL type id of MessageActionScreenshotTaken.
const MessageActionScreenshotTakenTypeID = 0x4792929b

// construct implements constructor of MessageActionClass.
func (m MessageActionScreenshotTaken) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionScreenshotTaken{}
)

func (m *MessageActionScreenshotTaken) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionScreenshotTaken) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionScreenshotTaken#4792929b as nil")
	}
	b.PutID(MessageActionScreenshotTakenTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionScreenshotTaken) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionScreenshotTaken#4792929b as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionScreenshotTaken) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionScreenshotTaken#4792929b to nil")
	}
	if err := b.ConsumeID(MessageActionScreenshotTakenTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionScreenshotTaken#4792929b: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionScreenshotTaken) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionScreenshotTaken#4792929b to nil")
	}
	return nil
}

// MessageActionCustomAction represents TL type `messageActionCustomAction#fae69f56`.
// Custom action (most likely not supported by the current layer, an upgrade might be
// needed)
//
// See https://core.telegram.org/constructor/messageActionCustomAction for reference.
type MessageActionCustomAction struct {
	// Action message
	Message string
}

// MessageActionCustomActionTypeID is TL type id of MessageActionCustomAction.
const MessageActionCustomActionTypeID = 0xfae69f56

// construct implements constructor of MessageActionClass.
func (m MessageActionCustomAction) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionCustomAction{}
)

func (m *MessageActionCustomAction) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Message == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionCustomAction from given interface.
func (m *MessageActionCustomAction) FillFrom(from interface {
	GetMessage() (value string)
}) {
	m.Message = from.GetMessage()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionCustomAction) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionCustomAction",
		ID:   MessageActionCustomActionTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Message",
			SchemaName: "message",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionCustomAction) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionCustomAction#fae69f56 as nil")
	}
	b.PutID(MessageActionCustomActionTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionCustomAction) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionCustomAction#fae69f56 as nil")
	}
	b.PutString(m.Message)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionCustomAction) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionCustomAction#fae69f56 to nil")
	}
	if err := b.ConsumeID(MessageActionCustomActionTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionCustomAction#fae69f56: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionCustomAction) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionCustomAction#fae69f56 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionCustomAction#fae69f56: field message: %w", err)
		}
		m.Message = value
	}
	return nil
}

// GetMessage returns value of Message field.
func (m *MessageActionCustomAction) GetMessage() (value string) {
	if m == nil {
		return
	}
	return m.Message
}

// MessageActionBotAllowed represents TL type `messageActionBotAllowed#c516d679`.
// We have given the bot permission to send us direct messages.
// The optional fields specify how did we authorize the bot to send us messages.
//
// See https://core.telegram.org/constructor/messageActionBotAllowed for reference.
type MessageActionBotAllowed struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// We have authorized the bot to send us messages by installing the bot's attachment
	// menu¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/attach
	AttachMenu bool
	// We have authorized the bot to send us messages by logging into a website via Telegram
	// Login »¹; this field contains the domain name of the website on which the user has
	// logged in.
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login
	//
	// Use SetDomain and GetDomain helpers.
	Domain string
	// We have authorized the bot to send us messages by opening the specified bot web app¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/bots/webapps
	//
	// Use SetApp and GetApp helpers.
	App BotAppClass
}

// MessageActionBotAllowedTypeID is TL type id of MessageActionBotAllowed.
const MessageActionBotAllowedTypeID = 0xc516d679

// construct implements constructor of MessageActionClass.
func (m MessageActionBotAllowed) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionBotAllowed{}
)

func (m *MessageActionBotAllowed) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.AttachMenu == false) {
		return false
	}
	if !(m.Domain == "") {
		return false
	}
	if !(m.App == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionBotAllowed from given interface.
func (m *MessageActionBotAllowed) FillFrom(from interface {
	GetAttachMenu() (value bool)
	GetDomain() (value string, ok bool)
	GetApp() (value BotAppClass, ok bool)
}) {
	m.AttachMenu = from.GetAttachMenu()
	if val, ok := from.GetDomain(); ok {
		m.Domain = val
	}

	if val, ok := from.GetApp(); ok {
		m.App = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionBotAllowed) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionBotAllowed",
		ID:   MessageActionBotAllowedTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "AttachMenu",
			SchemaName: "attach_menu",
			Null:       !m.Flags.Has(1),
		},
		{
			Name:       "Domain",
			SchemaName: "domain",
			Null:       !m.Flags.Has(0),
		},
		{
			Name:       "App",
			SchemaName: "app",
			Null:       !m.Flags.Has(2),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionBotAllowed) SetFlags() {
	if !(m.AttachMenu == false) {
		m.Flags.Set(1)
	}
	if !(m.Domain == "") {
		m.Flags.Set(0)
	}
	if !(m.App == nil) {
		m.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionBotAllowed) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionBotAllowed#c516d679 as nil")
	}
	b.PutID(MessageActionBotAllowedTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionBotAllowed) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionBotAllowed#c516d679 as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionBotAllowed#c516d679: field flags: %w", err)
	}
	if m.Flags.Has(0) {
		b.PutString(m.Domain)
	}
	if m.Flags.Has(2) {
		if m.App == nil {
			return fmt.Errorf("unable to encode messageActionBotAllowed#c516d679: field app is nil")
		}
		if err := m.App.Encode(b); err != nil {
			return fmt.Errorf("unable to encode messageActionBotAllowed#c516d679: field app: %w", err)
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionBotAllowed) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionBotAllowed#c516d679 to nil")
	}
	if err := b.ConsumeID(MessageActionBotAllowedTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionBotAllowed#c516d679: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionBotAllowed) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionBotAllowed#c516d679 to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionBotAllowed#c516d679: field flags: %w", err)
		}
	}
	m.AttachMenu = m.Flags.Has(1)
	if m.Flags.Has(0) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionBotAllowed#c516d679: field domain: %w", err)
		}
		m.Domain = value
	}
	if m.Flags.Has(2) {
		value, err := DecodeBotApp(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionBotAllowed#c516d679: field app: %w", err)
		}
		m.App = value
	}
	return nil
}

// SetAttachMenu sets value of AttachMenu conditional field.
func (m *MessageActionBotAllowed) SetAttachMenu(value bool) {
	if value {
		m.Flags.Set(1)
		m.AttachMenu = true
	} else {
		m.Flags.Unset(1)
		m.AttachMenu = false
	}
}

// GetAttachMenu returns value of AttachMenu conditional field.
func (m *MessageActionBotAllowed) GetAttachMenu() (value bool) {
	if m == nil {
		return
	}
	return m.Flags.Has(1)
}

// SetDomain sets value of Domain conditional field.
func (m *MessageActionBotAllowed) SetDomain(value string) {
	m.Flags.Set(0)
	m.Domain = value
}

// GetDomain returns value of Domain conditional field and
// boolean which is true if field was set.
func (m *MessageActionBotAllowed) GetDomain() (value string, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.Domain, true
}

// SetApp sets value of App conditional field.
func (m *MessageActionBotAllowed) SetApp(value BotAppClass) {
	m.Flags.Set(2)
	m.App = value
}

// GetApp returns value of App conditional field and
// boolean which is true if field was set.
func (m *MessageActionBotAllowed) GetApp() (value BotAppClass, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(2) {
		return value, false
	}
	return m.App, true
}

// MessageActionSecureValuesSentMe represents TL type `messageActionSecureValuesSentMe#1b287353`.
// Secure telegram passport¹ values were received
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/constructor/messageActionSecureValuesSentMe for reference.
type MessageActionSecureValuesSentMe struct {
	// Vector with information about documents and other Telegram Passport elements that were
	// shared with the bot
	Values []SecureValue
	// Encrypted credentials required to decrypt the data
	Credentials SecureCredentialsEncrypted
}

// MessageActionSecureValuesSentMeTypeID is TL type id of MessageActionSecureValuesSentMe.
const MessageActionSecureValuesSentMeTypeID = 0x1b287353

// construct implements constructor of MessageActionClass.
func (m MessageActionSecureValuesSentMe) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSecureValuesSentMe{}
)

func (m *MessageActionSecureValuesSentMe) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Values == nil) {
		return false
	}
	if !(m.Credentials.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionSecureValuesSentMe from given interface.
func (m *MessageActionSecureValuesSentMe) FillFrom(from interface {
	GetValues() (value []SecureValue)
	GetCredentials() (value SecureCredentialsEncrypted)
}) {
	m.Values = from.GetValues()
	m.Credentials = from.GetCredentials()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionSecureValuesSentMe) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionSecureValuesSentMe",
		ID:   MessageActionSecureValuesSentMeTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Values",
			SchemaName: "values",
		},
		{
			Name:       "Credentials",
			SchemaName: "credentials",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionSecureValuesSentMe) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSecureValuesSentMe#1b287353 as nil")
	}
	b.PutID(MessageActionSecureValuesSentMeTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSecureValuesSentMe) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSecureValuesSentMe#1b287353 as nil")
	}
	b.PutVectorHeader(len(m.Values))
	for idx, v := range m.Values {
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode messageActionSecureValuesSentMe#1b287353: field values element with index %d: %w", idx, err)
		}
	}
	if err := m.Credentials.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionSecureValuesSentMe#1b287353: field credentials: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSecureValuesSentMe) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSecureValuesSentMe#1b287353 to nil")
	}
	if err := b.ConsumeID(MessageActionSecureValuesSentMeTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSecureValuesSentMe#1b287353: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionSecureValuesSentMe) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSecureValuesSentMe#1b287353 to nil")
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSecureValuesSentMe#1b287353: field values: %w", err)
		}

		if headerLen > 0 {
			m.Values = make([]SecureValue, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			var value SecureValue
			if err := value.Decode(b); err != nil {
				return fmt.Errorf("unable to decode messageActionSecureValuesSentMe#1b287353: field values: %w", err)
			}
			m.Values = append(m.Values, value)
		}
	}
	{
		if err := m.Credentials.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionSecureValuesSentMe#1b287353: field credentials: %w", err)
		}
	}
	return nil
}

// GetValues returns value of Values field.
func (m *MessageActionSecureValuesSentMe) GetValues() (value []SecureValue) {
	if m == nil {
		return
	}
	return m.Values
}

// GetCredentials returns value of Credentials field.
func (m *MessageActionSecureValuesSentMe) GetCredentials() (value SecureCredentialsEncrypted) {
	if m == nil {
		return
	}
	return m.Credentials
}

// MessageActionSecureValuesSent represents TL type `messageActionSecureValuesSent#d95c6154`.
// Request for secure telegram passport¹ values was sent
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/constructor/messageActionSecureValuesSent for reference.
type MessageActionSecureValuesSent struct {
	// Secure value types
	Types []SecureValueTypeClass
}

// MessageActionSecureValuesSentTypeID is TL type id of MessageActionSecureValuesSent.
const MessageActionSecureValuesSentTypeID = 0xd95c6154

// construct implements constructor of MessageActionClass.
func (m MessageActionSecureValuesSent) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSecureValuesSent{}
)

func (m *MessageActionSecureValuesSent) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Types == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionSecureValuesSent from given interface.
func (m *MessageActionSecureValuesSent) FillFrom(from interface {
	GetTypes() (value []SecureValueTypeClass)
}) {
	m.Types = from.GetTypes()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionSecureValuesSent) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionSecureValuesSent",
		ID:   MessageActionSecureValuesSentTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Types",
			SchemaName: "types",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionSecureValuesSent) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSecureValuesSent#d95c6154 as nil")
	}
	b.PutID(MessageActionSecureValuesSentTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSecureValuesSent) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSecureValuesSent#d95c6154 as nil")
	}
	b.PutVectorHeader(len(m.Types))
	for idx, v := range m.Types {
		if v == nil {
			return fmt.Errorf("unable to encode messageActionSecureValuesSent#d95c6154: field types element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode messageActionSecureValuesSent#d95c6154: field types element with index %d: %w", idx, err)
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSecureValuesSent) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSecureValuesSent#d95c6154 to nil")
	}
	if err := b.ConsumeID(MessageActionSecureValuesSentTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSecureValuesSent#d95c6154: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionSecureValuesSent) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSecureValuesSent#d95c6154 to nil")
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSecureValuesSent#d95c6154: field types: %w", err)
		}

		if headerLen > 0 {
			m.Types = make([]SecureValueTypeClass, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := DecodeSecureValueType(b)
			if err != nil {
				return fmt.Errorf("unable to decode messageActionSecureValuesSent#d95c6154: field types: %w", err)
			}
			m.Types = append(m.Types, value)
		}
	}
	return nil
}

// GetTypes returns value of Types field.
func (m *MessageActionSecureValuesSent) GetTypes() (value []SecureValueTypeClass) {
	if m == nil {
		return
	}
	return m.Types
}

// MapTypes returns field Types wrapped in SecureValueTypeClassArray helper.
func (m *MessageActionSecureValuesSent) MapTypes() (value SecureValueTypeClassArray) {
	return SecureValueTypeClassArray(m.Types)
}

// MessageActionContactSignUp represents TL type `messageActionContactSignUp#f3f25f76`.
// A contact just signed up to telegram
//
// See https://core.telegram.org/constructor/messageActionContactSignUp for reference.
type MessageActionContactSignUp struct {
}

// MessageActionContactSignUpTypeID is TL type id of MessageActionContactSignUp.
const MessageActionContactSignUpTypeID = 0xf3f25f76

// construct implements constructor of MessageActionClass.
func (m MessageActionContactSignUp) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionContactSignUp{}
)

func (m *MessageActionContactSignUp) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionContactSignUp) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionContactSignUp#f3f25f76 as nil")
	}
	b.PutID(MessageActionContactSignUpTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionContactSignUp) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionContactSignUp#f3f25f76 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionContactSignUp) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionContactSignUp#f3f25f76 to nil")
	}
	if err := b.ConsumeID(MessageActionContactSignUpTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionContactSignUp#f3f25f76: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionContactSignUp) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionContactSignUp#f3f25f76 to nil")
	}
	return nil
}

// MessageActionGeoProximityReached represents TL type `messageActionGeoProximityReached#98e0d697`.
// A user of the chat is now in proximity of another user
//
// See https://core.telegram.org/constructor/messageActionGeoProximityReached for reference.
type MessageActionGeoProximityReached struct {
	// The user or chat that is now in proximity of to_id
	FromID PeerClass
	// The user or chat that subscribed to live geolocation proximity alerts¹
	//
	// Links:
	//  1) https://core.telegram.org/api/live-location#proximity-alert
	ToID PeerClass
	// Distance, in meters (0-100000)
	Distance int
}

// MessageActionGeoProximityReachedTypeID is TL type id of MessageActionGeoProximityReached.
const MessageActionGeoProximityReachedTypeID = 0x98e0d697

// construct implements constructor of MessageActionClass.
func (m MessageActionGeoProximityReached) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionGeoProximityReached{}
)

func (m *MessageActionGeoProximityReached) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.FromID == nil) {
		return false
	}
	if !(m.ToID == nil) {
		return false
	}
	if !(m.Distance == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionGeoProximityReached from given interface.
func (m *MessageActionGeoProximityReached) FillFrom(from interface {
	GetFromID() (value PeerClass)
	GetToID() (value PeerClass)
	GetDistance() (value int)
}) {
	m.FromID = from.GetFromID()
	m.ToID = from.GetToID()
	m.Distance = from.GetDistance()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionGeoProximityReached) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionGeoProximityReached",
		ID:   MessageActionGeoProximityReachedTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "FromID",
			SchemaName: "from_id",
		},
		{
			Name:       "ToID",
			SchemaName: "to_id",
		},
		{
			Name:       "Distance",
			SchemaName: "distance",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionGeoProximityReached) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGeoProximityReached#98e0d697 as nil")
	}
	b.PutID(MessageActionGeoProximityReachedTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionGeoProximityReached) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGeoProximityReached#98e0d697 as nil")
	}
	if m.FromID == nil {
		return fmt.Errorf("unable to encode messageActionGeoProximityReached#98e0d697: field from_id is nil")
	}
	if err := m.FromID.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionGeoProximityReached#98e0d697: field from_id: %w", err)
	}
	if m.ToID == nil {
		return fmt.Errorf("unable to encode messageActionGeoProximityReached#98e0d697: field to_id is nil")
	}
	if err := m.ToID.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionGeoProximityReached#98e0d697: field to_id: %w", err)
	}
	b.PutInt(m.Distance)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionGeoProximityReached) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGeoProximityReached#98e0d697 to nil")
	}
	if err := b.ConsumeID(MessageActionGeoProximityReachedTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionGeoProximityReached#98e0d697: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionGeoProximityReached) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGeoProximityReached#98e0d697 to nil")
	}
	{
		value, err := DecodePeer(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGeoProximityReached#98e0d697: field from_id: %w", err)
		}
		m.FromID = value
	}
	{
		value, err := DecodePeer(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGeoProximityReached#98e0d697: field to_id: %w", err)
		}
		m.ToID = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGeoProximityReached#98e0d697: field distance: %w", err)
		}
		m.Distance = value
	}
	return nil
}

// GetFromID returns value of FromID field.
func (m *MessageActionGeoProximityReached) GetFromID() (value PeerClass) {
	if m == nil {
		return
	}
	return m.FromID
}

// GetToID returns value of ToID field.
func (m *MessageActionGeoProximityReached) GetToID() (value PeerClass) {
	if m == nil {
		return
	}
	return m.ToID
}

// GetDistance returns value of Distance field.
func (m *MessageActionGeoProximityReached) GetDistance() (value int) {
	if m == nil {
		return
	}
	return m.Distance
}

// MessageActionGroupCall represents TL type `messageActionGroupCall#7a0d7f42`.
// The group call has ended
//
// See https://core.telegram.org/constructor/messageActionGroupCall for reference.
type MessageActionGroupCall struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Group call
	Call InputGroupCall
	// Group call duration
	//
	// Use SetDuration and GetDuration helpers.
	Duration int
}

// MessageActionGroupCallTypeID is TL type id of MessageActionGroupCall.
const MessageActionGroupCallTypeID = 0x7a0d7f42

// construct implements constructor of MessageActionClass.
func (m MessageActionGroupCall) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionGroupCall{}
)

func (m *MessageActionGroupCall) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.Call.Zero()) {
		return false
	}
	if !(m.Duration == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionGroupCall from given interface.
func (m *MessageActionGroupCall) FillFrom(from interface {
	GetCall() (value InputGroupCall)
	GetDuration() (value int, ok bool)
}) {
	m.Call = from.GetCall()
	if val, ok := from.GetDuration(); ok {
		m.Duration = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionGroupCall) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionGroupCall",
		ID:   MessageActionGroupCallTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Duration",
			SchemaName: "duration",
			Null:       !m.Flags.Has(0),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionGroupCall) SetFlags() {
	if !(m.Duration == 0) {
		m.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionGroupCall) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGroupCall#7a0d7f42 as nil")
	}
	b.PutID(MessageActionGroupCallTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionGroupCall) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGroupCall#7a0d7f42 as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionGroupCall#7a0d7f42: field flags: %w", err)
	}
	if err := m.Call.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionGroupCall#7a0d7f42: field call: %w", err)
	}
	if m.Flags.Has(0) {
		b.PutInt(m.Duration)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionGroupCall) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGroupCall#7a0d7f42 to nil")
	}
	if err := b.ConsumeID(MessageActionGroupCallTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionGroupCall#7a0d7f42: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionGroupCall) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGroupCall#7a0d7f42 to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionGroupCall#7a0d7f42: field flags: %w", err)
		}
	}
	{
		if err := m.Call.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionGroupCall#7a0d7f42: field call: %w", err)
		}
	}
	if m.Flags.Has(0) {
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGroupCall#7a0d7f42: field duration: %w", err)
		}
		m.Duration = value
	}
	return nil
}

// GetCall returns value of Call field.
func (m *MessageActionGroupCall) GetCall() (value InputGroupCall) {
	if m == nil {
		return
	}
	return m.Call
}

// SetDuration sets value of Duration conditional field.
func (m *MessageActionGroupCall) SetDuration(value int) {
	m.Flags.Set(0)
	m.Duration = value
}

// GetDuration returns value of Duration conditional field and
// boolean which is true if field was set.
func (m *MessageActionGroupCall) GetDuration() (value int, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.Duration, true
}

// MessageActionInviteToGroupCall represents TL type `messageActionInviteToGroupCall#502f92f7`.
// A set of users was invited to the group call
//
// See https://core.telegram.org/constructor/messageActionInviteToGroupCall for reference.
type MessageActionInviteToGroupCall struct {
	// The group call
	Call InputGroupCall
	// The invited users
	Users []int64
}

// MessageActionInviteToGroupCallTypeID is TL type id of MessageActionInviteToGroupCall.
const MessageActionInviteToGroupCallTypeID = 0x502f92f7

// construct implements constructor of MessageActionClass.
func (m MessageActionInviteToGroupCall) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionInviteToGroupCall{}
)

func (m *MessageActionInviteToGroupCall) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Call.Zero()) {
		return false
	}
	if !(m.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionInviteToGroupCall from given interface.
func (m *MessageActionInviteToGroupCall) FillFrom(from interface {
	GetCall() (value InputGroupCall)
	GetUsers() (value []int64)
}) {
	m.Call = from.GetCall()
	m.Users = from.GetUsers()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionInviteToGroupCall) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionInviteToGroupCall",
		ID:   MessageActionInviteToGroupCallTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionInviteToGroupCall) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionInviteToGroupCall#502f92f7 as nil")
	}
	b.PutID(MessageActionInviteToGroupCallTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionInviteToGroupCall) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionInviteToGroupCall#502f92f7 as nil")
	}
	if err := m.Call.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionInviteToGroupCall#502f92f7: field call: %w", err)
	}
	b.PutVectorHeader(len(m.Users))
	for _, v := range m.Users {
		b.PutLong(v)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionInviteToGroupCall) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionInviteToGroupCall#502f92f7 to nil")
	}
	if err := b.ConsumeID(MessageActionInviteToGroupCallTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionInviteToGroupCall#502f92f7: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionInviteToGroupCall) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionInviteToGroupCall#502f92f7 to nil")
	}
	{
		if err := m.Call.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionInviteToGroupCall#502f92f7: field call: %w", err)
		}
	}
	{
		headerLen, err := b.VectorHeader()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionInviteToGroupCall#502f92f7: field users: %w", err)
		}

		if headerLen > 0 {
			m.Users = make([]int64, 0, headerLen%bin.PreallocateLimit)
		}
		for idx := 0; idx < headerLen; idx++ {
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode messageActionInviteToGroupCall#502f92f7: field users: %w", err)
			}
			m.Users = append(m.Users, value)
		}
	}
	return nil
}

// GetCall returns value of Call field.
func (m *MessageActionInviteToGroupCall) GetCall() (value InputGroupCall) {
	if m == nil {
		return
	}
	return m.Call
}

// GetUsers returns value of Users field.
func (m *MessageActionInviteToGroupCall) GetUsers() (value []int64) {
	if m == nil {
		return
	}
	return m.Users
}

// MessageActionSetMessagesTTL represents TL type `messageActionSetMessagesTTL#3c134d7b`.
// The Time-To-Live of messages in this chat was changed.
//
// See https://core.telegram.org/constructor/messageActionSetMessagesTTL for reference.
type MessageActionSetMessagesTTL struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// New Time-To-Live of all messages sent in this chat; if 0, autodeletion was disabled.
	Period int
	// If set, the chat TTL setting was set not due to a manual change by one of participants
	// but automatically because one of the participants has the default TTL settings
	// enabled »¹. For example, when a user writes to us for the first time and we have set
	// a default messages TTL of 1 week, this service message (with
	// auto_setting_from=our_userid) will be emitted before our first message.
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.setDefaultHistoryTTL
	//
	// Use SetAutoSettingFrom and GetAutoSettingFrom helpers.
	AutoSettingFrom int64
}

// MessageActionSetMessagesTTLTypeID is TL type id of MessageActionSetMessagesTTL.
const MessageActionSetMessagesTTLTypeID = 0x3c134d7b

// construct implements constructor of MessageActionClass.
func (m MessageActionSetMessagesTTL) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSetMessagesTTL{}
)

func (m *MessageActionSetMessagesTTL) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.Period == 0) {
		return false
	}
	if !(m.AutoSettingFrom == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionSetMessagesTTL from given interface.
func (m *MessageActionSetMessagesTTL) FillFrom(from interface {
	GetPeriod() (value int)
	GetAutoSettingFrom() (value int64, ok bool)
}) {
	m.Period = from.GetPeriod()
	if val, ok := from.GetAutoSettingFrom(); ok {
		m.AutoSettingFrom = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionSetMessagesTTL) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionSetMessagesTTL",
		ID:   MessageActionSetMessagesTTLTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Period",
			SchemaName: "period",
		},
		{
			Name:       "AutoSettingFrom",
			SchemaName: "auto_setting_from",
			Null:       !m.Flags.Has(0),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionSetMessagesTTL) SetFlags() {
	if !(m.AutoSettingFrom == 0) {
		m.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionSetMessagesTTL) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetMessagesTTL#3c134d7b as nil")
	}
	b.PutID(MessageActionSetMessagesTTLTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSetMessagesTTL) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetMessagesTTL#3c134d7b as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionSetMessagesTTL#3c134d7b: field flags: %w", err)
	}
	b.PutInt(m.Period)
	if m.Flags.Has(0) {
		b.PutLong(m.AutoSettingFrom)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSetMessagesTTL) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetMessagesTTL#3c134d7b to nil")
	}
	if err := b.ConsumeID(MessageActionSetMessagesTTLTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionSetMessagesTTL) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetMessagesTTL#3c134d7b to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: field flags: %w", err)
		}
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: field period: %w", err)
		}
		m.Period = value
	}
	if m.Flags.Has(0) {
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSetMessagesTTL#3c134d7b: field auto_setting_from: %w", err)
		}
		m.AutoSettingFrom = value
	}
	return nil
}

// GetPeriod returns value of Period field.
func (m *MessageActionSetMessagesTTL) GetPeriod() (value int) {
	if m == nil {
		return
	}
	return m.Period
}

// SetAutoSettingFrom sets value of AutoSettingFrom conditional field.
func (m *MessageActionSetMessagesTTL) SetAutoSettingFrom(value int64) {
	m.Flags.Set(0)
	m.AutoSettingFrom = value
}

// GetAutoSettingFrom returns value of AutoSettingFrom conditional field and
// boolean which is true if field was set.
func (m *MessageActionSetMessagesTTL) GetAutoSettingFrom() (value int64, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.AutoSettingFrom, true
}

// MessageActionGroupCallScheduled represents TL type `messageActionGroupCallScheduled#b3a07661`.
// A group call was scheduled
//
// See https://core.telegram.org/constructor/messageActionGroupCallScheduled for reference.
type MessageActionGroupCallScheduled struct {
	// The group call
	Call InputGroupCall
	// When is this group call scheduled to start
	ScheduleDate int
}

// MessageActionGroupCallScheduledTypeID is TL type id of MessageActionGroupCallScheduled.
const MessageActionGroupCallScheduledTypeID = 0xb3a07661

// construct implements constructor of MessageActionClass.
func (m MessageActionGroupCallScheduled) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionGroupCallScheduled{}
)

func (m *MessageActionGroupCallScheduled) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Call.Zero()) {
		return false
	}
	if !(m.ScheduleDate == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionGroupCallScheduled from given interface.
func (m *MessageActionGroupCallScheduled) FillFrom(from interface {
	GetCall() (value InputGroupCall)
	GetScheduleDate() (value int)
}) {
	m.Call = from.GetCall()
	m.ScheduleDate = from.GetScheduleDate()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionGroupCallScheduled) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionGroupCallScheduled",
		ID:   MessageActionGroupCallScheduledTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "ScheduleDate",
			SchemaName: "schedule_date",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionGroupCallScheduled) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGroupCallScheduled#b3a07661 as nil")
	}
	b.PutID(MessageActionGroupCallScheduledTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionGroupCallScheduled) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGroupCallScheduled#b3a07661 as nil")
	}
	if err := m.Call.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionGroupCallScheduled#b3a07661: field call: %w", err)
	}
	b.PutInt(m.ScheduleDate)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionGroupCallScheduled) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGroupCallScheduled#b3a07661 to nil")
	}
	if err := b.ConsumeID(MessageActionGroupCallScheduledTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionGroupCallScheduled#b3a07661: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionGroupCallScheduled) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGroupCallScheduled#b3a07661 to nil")
	}
	{
		if err := m.Call.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionGroupCallScheduled#b3a07661: field call: %w", err)
		}
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGroupCallScheduled#b3a07661: field schedule_date: %w", err)
		}
		m.ScheduleDate = value
	}
	return nil
}

// GetCall returns value of Call field.
func (m *MessageActionGroupCallScheduled) GetCall() (value InputGroupCall) {
	if m == nil {
		return
	}
	return m.Call
}

// GetScheduleDate returns value of ScheduleDate field.
func (m *MessageActionGroupCallScheduled) GetScheduleDate() (value int) {
	if m == nil {
		return
	}
	return m.ScheduleDate
}

// MessageActionSetChatTheme represents TL type `messageActionSetChatTheme#aa786345`.
// The chat theme was changed
//
// See https://core.telegram.org/constructor/messageActionSetChatTheme for reference.
type MessageActionSetChatTheme struct {
	// The emoji that identifies a chat theme
	Emoticon string
}

// MessageActionSetChatThemeTypeID is TL type id of MessageActionSetChatTheme.
const MessageActionSetChatThemeTypeID = 0xaa786345

// construct implements constructor of MessageActionClass.
func (m MessageActionSetChatTheme) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSetChatTheme{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionSetChatTheme) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetChatTheme#aa786345 as nil")
	}
	b.PutID(MessageActionSetChatThemeTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSetChatTheme) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetChatTheme#aa786345 as nil")
	}
	b.PutString(m.Emoticon)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSetChatTheme) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetChatTheme#aa786345 to nil")
	}
	if err := b.ConsumeID(MessageActionSetChatThemeTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSetChatTheme#aa786345: %w", err)
	}
	return m.DecodeBare(b)
}

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

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

// MessageActionChatJoinedByRequest represents TL type `messageActionChatJoinedByRequest#ebbca3cb`.
// A user was accepted into the group by an admin
//
// See https://core.telegram.org/constructor/messageActionChatJoinedByRequest for reference.
type MessageActionChatJoinedByRequest struct {
}

// MessageActionChatJoinedByRequestTypeID is TL type id of MessageActionChatJoinedByRequest.
const MessageActionChatJoinedByRequestTypeID = 0xebbca3cb

// construct implements constructor of MessageActionClass.
func (m MessageActionChatJoinedByRequest) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionChatJoinedByRequest{}
)

func (m *MessageActionChatJoinedByRequest) Zero() bool {
	if m == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (m *MessageActionChatJoinedByRequest) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatJoinedByRequest#ebbca3cb as nil")
	}
	b.PutID(MessageActionChatJoinedByRequestTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionChatJoinedByRequest) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionChatJoinedByRequest#ebbca3cb as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionChatJoinedByRequest) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatJoinedByRequest#ebbca3cb to nil")
	}
	if err := b.ConsumeID(MessageActionChatJoinedByRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionChatJoinedByRequest#ebbca3cb: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionChatJoinedByRequest) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionChatJoinedByRequest#ebbca3cb to nil")
	}
	return nil
}

// MessageActionWebViewDataSentMe represents TL type `messageActionWebViewDataSentMe#47dd8079`.
// Data from an opened reply keyboard bot web app¹ was relayed to the bot that owns it
// (bot side service message).
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps
//
// See https://core.telegram.org/constructor/messageActionWebViewDataSentMe for reference.
type MessageActionWebViewDataSentMe struct {
	// Text of the keyboardButtonSimpleWebView¹ that was pressed to open the web app.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/keyboardButtonSimpleWebView
	Text string
	// Relayed data.
	Data string
}

// MessageActionWebViewDataSentMeTypeID is TL type id of MessageActionWebViewDataSentMe.
const MessageActionWebViewDataSentMeTypeID = 0x47dd8079

// construct implements constructor of MessageActionClass.
func (m MessageActionWebViewDataSentMe) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionWebViewDataSentMe{}
)

func (m *MessageActionWebViewDataSentMe) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Text == "") {
		return false
	}
	if !(m.Data == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionWebViewDataSentMe from given interface.
func (m *MessageActionWebViewDataSentMe) FillFrom(from interface {
	GetText() (value string)
	GetData() (value string)
}) {
	m.Text = from.GetText()
	m.Data = from.GetData()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionWebViewDataSentMe) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionWebViewDataSentMe",
		ID:   MessageActionWebViewDataSentMeTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Data",
			SchemaName: "data",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionWebViewDataSentMe) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionWebViewDataSentMe#47dd8079 as nil")
	}
	b.PutID(MessageActionWebViewDataSentMeTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionWebViewDataSentMe) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionWebViewDataSentMe#47dd8079 as nil")
	}
	b.PutString(m.Text)
	b.PutString(m.Data)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionWebViewDataSentMe) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionWebViewDataSentMe#47dd8079 to nil")
	}
	if err := b.ConsumeID(MessageActionWebViewDataSentMeTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionWebViewDataSentMe#47dd8079: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionWebViewDataSentMe) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionWebViewDataSentMe#47dd8079 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionWebViewDataSentMe#47dd8079: field text: %w", err)
		}
		m.Text = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionWebViewDataSentMe#47dd8079: field data: %w", err)
		}
		m.Data = value
	}
	return nil
}

// GetText returns value of Text field.
func (m *MessageActionWebViewDataSentMe) GetText() (value string) {
	if m == nil {
		return
	}
	return m.Text
}

// GetData returns value of Data field.
func (m *MessageActionWebViewDataSentMe) GetData() (value string) {
	if m == nil {
		return
	}
	return m.Data
}

// MessageActionWebViewDataSent represents TL type `messageActionWebViewDataSent#b4c38cb5`.
// Data from an opened reply keyboard bot web app¹ was relayed to the bot that owns it
// (user side service message).
// Clients should display a service message with the text Data from the «$text» button
// was transferred to the bot.
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps
//
// See https://core.telegram.org/constructor/messageActionWebViewDataSent for reference.
type MessageActionWebViewDataSent struct {
	// Text of the keyboardButtonSimpleWebView¹ that was pressed to open the web app.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/keyboardButtonSimpleWebView
	Text string
}

// MessageActionWebViewDataSentTypeID is TL type id of MessageActionWebViewDataSent.
const MessageActionWebViewDataSentTypeID = 0xb4c38cb5

// construct implements constructor of MessageActionClass.
func (m MessageActionWebViewDataSent) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionWebViewDataSent{}
)

func (m *MessageActionWebViewDataSent) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionWebViewDataSent from given interface.
func (m *MessageActionWebViewDataSent) FillFrom(from interface {
	GetText() (value string)
}) {
	m.Text = from.GetText()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionWebViewDataSent) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionWebViewDataSent",
		ID:   MessageActionWebViewDataSentTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionWebViewDataSent) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionWebViewDataSent#b4c38cb5 as nil")
	}
	b.PutID(MessageActionWebViewDataSentTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionWebViewDataSent) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionWebViewDataSent#b4c38cb5 as nil")
	}
	b.PutString(m.Text)
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionWebViewDataSent) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionWebViewDataSent#b4c38cb5 to nil")
	}
	if err := b.ConsumeID(MessageActionWebViewDataSentTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionWebViewDataSent#b4c38cb5: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionWebViewDataSent) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionWebViewDataSent#b4c38cb5 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionWebViewDataSent#b4c38cb5: field text: %w", err)
		}
		m.Text = value
	}
	return nil
}

// GetText returns value of Text field.
func (m *MessageActionWebViewDataSent) GetText() (value string) {
	if m == nil {
		return
	}
	return m.Text
}

// MessageActionGiftPremium represents TL type `messageActionGiftPremium#c83d6aec`.
// Info about a gifted Telegram Premium subscription
//
// See https://core.telegram.org/constructor/messageActionGiftPremium for reference.
type MessageActionGiftPremium struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Three-letter ISO 4217 currency¹ code
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments#supported-currencies
	Currency string
	// Price of the gift in the smallest units of the currency (integer, not float/double).
	// For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
	// currencies.json¹, it shows the number of digits past the decimal point for each
	// currency (2 for the majority of currencies).
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments/currencies.json
	Amount int64
	// Duration of the gifted Telegram Premium subscription
	Months int
	// If the gift was bought using a cryptocurrency, the cryptocurrency name.
	//
	// Use SetCryptoCurrency and GetCryptoCurrency helpers.
	CryptoCurrency string
	// If the gift was bought using a cryptocurrency, price of the gift in the smallest units
	// of a cryptocurrency.
	//
	// Use SetCryptoAmount and GetCryptoAmount helpers.
	CryptoAmount int64
}

// MessageActionGiftPremiumTypeID is TL type id of MessageActionGiftPremium.
const MessageActionGiftPremiumTypeID = 0xc83d6aec

// construct implements constructor of MessageActionClass.
func (m MessageActionGiftPremium) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionGiftPremium{}
)

func (m *MessageActionGiftPremium) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.Currency == "") {
		return false
	}
	if !(m.Amount == 0) {
		return false
	}
	if !(m.Months == 0) {
		return false
	}
	if !(m.CryptoCurrency == "") {
		return false
	}
	if !(m.CryptoAmount == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionGiftPremium from given interface.
func (m *MessageActionGiftPremium) FillFrom(from interface {
	GetCurrency() (value string)
	GetAmount() (value int64)
	GetMonths() (value int)
	GetCryptoCurrency() (value string, ok bool)
	GetCryptoAmount() (value int64, ok bool)
}) {
	m.Currency = from.GetCurrency()
	m.Amount = from.GetAmount()
	m.Months = from.GetMonths()
	if val, ok := from.GetCryptoCurrency(); ok {
		m.CryptoCurrency = val
	}

	if val, ok := from.GetCryptoAmount(); ok {
		m.CryptoAmount = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionGiftPremium) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionGiftPremium",
		ID:   MessageActionGiftPremiumTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Currency",
			SchemaName: "currency",
		},
		{
			Name:       "Amount",
			SchemaName: "amount",
		},
		{
			Name:       "Months",
			SchemaName: "months",
		},
		{
			Name:       "CryptoCurrency",
			SchemaName: "crypto_currency",
			Null:       !m.Flags.Has(0),
		},
		{
			Name:       "CryptoAmount",
			SchemaName: "crypto_amount",
			Null:       !m.Flags.Has(0),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionGiftPremium) SetFlags() {
	if !(m.CryptoCurrency == "") {
		m.Flags.Set(0)
	}
	if !(m.CryptoAmount == 0) {
		m.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionGiftPremium) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGiftPremium#c83d6aec as nil")
	}
	b.PutID(MessageActionGiftPremiumTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionGiftPremium) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionGiftPremium#c83d6aec as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionGiftPremium#c83d6aec: field flags: %w", err)
	}
	b.PutString(m.Currency)
	b.PutLong(m.Amount)
	b.PutInt(m.Months)
	if m.Flags.Has(0) {
		b.PutString(m.CryptoCurrency)
	}
	if m.Flags.Has(0) {
		b.PutLong(m.CryptoAmount)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionGiftPremium) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGiftPremium#c83d6aec to nil")
	}
	if err := b.ConsumeID(MessageActionGiftPremiumTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionGiftPremium) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionGiftPremium#c83d6aec to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field flags: %w", err)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field currency: %w", err)
		}
		m.Currency = value
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field amount: %w", err)
		}
		m.Amount = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field months: %w", err)
		}
		m.Months = value
	}
	if m.Flags.Has(0) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field crypto_currency: %w", err)
		}
		m.CryptoCurrency = value
	}
	if m.Flags.Has(0) {
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionGiftPremium#c83d6aec: field crypto_amount: %w", err)
		}
		m.CryptoAmount = value
	}
	return nil
}

// GetCurrency returns value of Currency field.
func (m *MessageActionGiftPremium) GetCurrency() (value string) {
	if m == nil {
		return
	}
	return m.Currency
}

// GetAmount returns value of Amount field.
func (m *MessageActionGiftPremium) GetAmount() (value int64) {
	if m == nil {
		return
	}
	return m.Amount
}

// GetMonths returns value of Months field.
func (m *MessageActionGiftPremium) GetMonths() (value int) {
	if m == nil {
		return
	}
	return m.Months
}

// SetCryptoCurrency sets value of CryptoCurrency conditional field.
func (m *MessageActionGiftPremium) SetCryptoCurrency(value string) {
	m.Flags.Set(0)
	m.CryptoCurrency = value
}

// GetCryptoCurrency returns value of CryptoCurrency conditional field and
// boolean which is true if field was set.
func (m *MessageActionGiftPremium) GetCryptoCurrency() (value string, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.CryptoCurrency, true
}

// SetCryptoAmount sets value of CryptoAmount conditional field.
func (m *MessageActionGiftPremium) SetCryptoAmount(value int64) {
	m.Flags.Set(0)
	m.CryptoAmount = value
}

// GetCryptoAmount returns value of CryptoAmount conditional field and
// boolean which is true if field was set.
func (m *MessageActionGiftPremium) GetCryptoAmount() (value int64, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.CryptoAmount, true
}

// MessageActionTopicCreate represents TL type `messageActionTopicCreate#d999256`.
// A forum topic¹ was created.
//
// Links:
//  1. https://core.telegram.org/api/forum#forum-topics
//
// See https://core.telegram.org/constructor/messageActionTopicCreate for reference.
type MessageActionTopicCreate struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Topic name.
	Title string
	// If no custom emoji icon is specified, specifies the color of the fallback topic icon
	// (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F.
	IconColor int
	// ID of the custom emoji¹ used as topic icon.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	//
	// Use SetIconEmojiID and GetIconEmojiID helpers.
	IconEmojiID int64
}

// MessageActionTopicCreateTypeID is TL type id of MessageActionTopicCreate.
const MessageActionTopicCreateTypeID = 0xd999256

// construct implements constructor of MessageActionClass.
func (m MessageActionTopicCreate) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionTopicCreate{}
)

func (m *MessageActionTopicCreate) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.Title == "") {
		return false
	}
	if !(m.IconColor == 0) {
		return false
	}
	if !(m.IconEmojiID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionTopicCreate from given interface.
func (m *MessageActionTopicCreate) FillFrom(from interface {
	GetTitle() (value string)
	GetIconColor() (value int)
	GetIconEmojiID() (value int64, ok bool)
}) {
	m.Title = from.GetTitle()
	m.IconColor = from.GetIconColor()
	if val, ok := from.GetIconEmojiID(); ok {
		m.IconEmojiID = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionTopicCreate) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionTopicCreate",
		ID:   MessageActionTopicCreateTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "IconColor",
			SchemaName: "icon_color",
		},
		{
			Name:       "IconEmojiID",
			SchemaName: "icon_emoji_id",
			Null:       !m.Flags.Has(0),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionTopicCreate) SetFlags() {
	if !(m.IconEmojiID == 0) {
		m.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionTopicCreate) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionTopicCreate#d999256 as nil")
	}
	b.PutID(MessageActionTopicCreateTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionTopicCreate) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionTopicCreate#d999256 as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionTopicCreate#d999256: field flags: %w", err)
	}
	b.PutString(m.Title)
	b.PutInt(m.IconColor)
	if m.Flags.Has(0) {
		b.PutLong(m.IconEmojiID)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionTopicCreate) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionTopicCreate#d999256 to nil")
	}
	if err := b.ConsumeID(MessageActionTopicCreateTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionTopicCreate#d999256: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionTopicCreate) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionTopicCreate#d999256 to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionTopicCreate#d999256: field flags: %w", err)
		}
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicCreate#d999256: field title: %w", err)
		}
		m.Title = value
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicCreate#d999256: field icon_color: %w", err)
		}
		m.IconColor = value
	}
	if m.Flags.Has(0) {
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicCreate#d999256: field icon_emoji_id: %w", err)
		}
		m.IconEmojiID = value
	}
	return nil
}

// GetTitle returns value of Title field.
func (m *MessageActionTopicCreate) GetTitle() (value string) {
	if m == nil {
		return
	}
	return m.Title
}

// GetIconColor returns value of IconColor field.
func (m *MessageActionTopicCreate) GetIconColor() (value int) {
	if m == nil {
		return
	}
	return m.IconColor
}

// SetIconEmojiID sets value of IconEmojiID conditional field.
func (m *MessageActionTopicCreate) SetIconEmojiID(value int64) {
	m.Flags.Set(0)
	m.IconEmojiID = value
}

// GetIconEmojiID returns value of IconEmojiID conditional field and
// boolean which is true if field was set.
func (m *MessageActionTopicCreate) GetIconEmojiID() (value int64, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.IconEmojiID, true
}

// MessageActionTopicEdit represents TL type `messageActionTopicEdit#c0944820`.
// Forum topic¹ information was edited.
//
// Links:
//  1. https://core.telegram.org/api/forum#forum-topics
//
// See https://core.telegram.org/constructor/messageActionTopicEdit for reference.
type MessageActionTopicEdit struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Topic title.
	//
	// Use SetTitle and GetTitle helpers.
	Title string
	// ID of the custom emoji¹ used as topic icon.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	//
	// Use SetIconEmojiID and GetIconEmojiID helpers.
	IconEmojiID int64
	// Whether the topic was closed.
	//
	// Use SetClosed and GetClosed helpers.
	Closed bool
	// Whether the topic was hidden (only valid for the "General" topic, id=1).
	//
	// Use SetHidden and GetHidden helpers.
	Hidden bool
}

// MessageActionTopicEditTypeID is TL type id of MessageActionTopicEdit.
const MessageActionTopicEditTypeID = 0xc0944820

// construct implements constructor of MessageActionClass.
func (m MessageActionTopicEdit) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionTopicEdit{}
)

func (m *MessageActionTopicEdit) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Flags.Zero()) {
		return false
	}
	if !(m.Title == "") {
		return false
	}
	if !(m.IconEmojiID == 0) {
		return false
	}
	if !(m.Closed == false) {
		return false
	}
	if !(m.Hidden == false) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionTopicEdit from given interface.
func (m *MessageActionTopicEdit) FillFrom(from interface {
	GetTitle() (value string, ok bool)
	GetIconEmojiID() (value int64, ok bool)
	GetClosed() (value bool, ok bool)
	GetHidden() (value bool, ok bool)
}) {
	if val, ok := from.GetTitle(); ok {
		m.Title = val
	}

	if val, ok := from.GetIconEmojiID(); ok {
		m.IconEmojiID = val
	}

	if val, ok := from.GetClosed(); ok {
		m.Closed = val
	}

	if val, ok := from.GetHidden(); ok {
		m.Hidden = val
	}

}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionTopicEdit) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionTopicEdit",
		ID:   MessageActionTopicEditTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
			Null:       !m.Flags.Has(0),
		},
		{
			Name:       "IconEmojiID",
			SchemaName: "icon_emoji_id",
			Null:       !m.Flags.Has(1),
		},
		{
			Name:       "Closed",
			SchemaName: "closed",
			Null:       !m.Flags.Has(2),
		},
		{
			Name:       "Hidden",
			SchemaName: "hidden",
			Null:       !m.Flags.Has(3),
		},
	}
	return typ
}

// SetFlags sets flags for non-zero fields.
func (m *MessageActionTopicEdit) SetFlags() {
	if !(m.Title == "") {
		m.Flags.Set(0)
	}
	if !(m.IconEmojiID == 0) {
		m.Flags.Set(1)
	}
	if !(m.Closed == false) {
		m.Flags.Set(2)
	}
	if !(m.Hidden == false) {
		m.Flags.Set(3)
	}
}

// Encode implements bin.Encoder.
func (m *MessageActionTopicEdit) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionTopicEdit#c0944820 as nil")
	}
	b.PutID(MessageActionTopicEditTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionTopicEdit) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionTopicEdit#c0944820 as nil")
	}
	m.SetFlags()
	if err := m.Flags.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionTopicEdit#c0944820: field flags: %w", err)
	}
	if m.Flags.Has(0) {
		b.PutString(m.Title)
	}
	if m.Flags.Has(1) {
		b.PutLong(m.IconEmojiID)
	}
	if m.Flags.Has(2) {
		b.PutBool(m.Closed)
	}
	if m.Flags.Has(3) {
		b.PutBool(m.Hidden)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionTopicEdit) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionTopicEdit#c0944820 to nil")
	}
	if err := b.ConsumeID(MessageActionTopicEditTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionTopicEdit) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionTopicEdit#c0944820 to nil")
	}
	{
		if err := m.Flags.Decode(b); err != nil {
			return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field flags: %w", err)
		}
	}
	if m.Flags.Has(0) {
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field title: %w", err)
		}
		m.Title = value
	}
	if m.Flags.Has(1) {
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field icon_emoji_id: %w", err)
		}
		m.IconEmojiID = value
	}
	if m.Flags.Has(2) {
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field closed: %w", err)
		}
		m.Closed = value
	}
	if m.Flags.Has(3) {
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionTopicEdit#c0944820: field hidden: %w", err)
		}
		m.Hidden = value
	}
	return nil
}

// SetTitle sets value of Title conditional field.
func (m *MessageActionTopicEdit) SetTitle(value string) {
	m.Flags.Set(0)
	m.Title = value
}

// GetTitle returns value of Title conditional field and
// boolean which is true if field was set.
func (m *MessageActionTopicEdit) GetTitle() (value string, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(0) {
		return value, false
	}
	return m.Title, true
}

// SetIconEmojiID sets value of IconEmojiID conditional field.
func (m *MessageActionTopicEdit) SetIconEmojiID(value int64) {
	m.Flags.Set(1)
	m.IconEmojiID = value
}

// GetIconEmojiID returns value of IconEmojiID conditional field and
// boolean which is true if field was set.
func (m *MessageActionTopicEdit) GetIconEmojiID() (value int64, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(1) {
		return value, false
	}
	return m.IconEmojiID, true
}

// SetClosed sets value of Closed conditional field.
func (m *MessageActionTopicEdit) SetClosed(value bool) {
	m.Flags.Set(2)
	m.Closed = value
}

// GetClosed returns value of Closed conditional field and
// boolean which is true if field was set.
func (m *MessageActionTopicEdit) GetClosed() (value bool, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(2) {
		return value, false
	}
	return m.Closed, true
}

// SetHidden sets value of Hidden conditional field.
func (m *MessageActionTopicEdit) SetHidden(value bool) {
	m.Flags.Set(3)
	m.Hidden = value
}

// GetHidden returns value of Hidden conditional field and
// boolean which is true if field was set.
func (m *MessageActionTopicEdit) GetHidden() (value bool, ok bool) {
	if m == nil {
		return
	}
	if !m.Flags.Has(3) {
		return value, false
	}
	return m.Hidden, true
}

// MessageActionSuggestProfilePhoto represents TL type `messageActionSuggestProfilePhoto#57de635e`.
// A new profile picture was suggested using photos.uploadContactProfilePhoto¹.
//
// Links:
//  1. https://core.telegram.org/method/photos.uploadContactProfilePhoto
//
// See https://core.telegram.org/constructor/messageActionSuggestProfilePhoto for reference.
type MessageActionSuggestProfilePhoto struct {
	// The photo that the user suggested we set as profile picture.
	Photo PhotoClass
}

// MessageActionSuggestProfilePhotoTypeID is TL type id of MessageActionSuggestProfilePhoto.
const MessageActionSuggestProfilePhotoTypeID = 0x57de635e

// construct implements constructor of MessageActionClass.
func (m MessageActionSuggestProfilePhoto) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSuggestProfilePhoto{}
)

func (m *MessageActionSuggestProfilePhoto) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Photo == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionSuggestProfilePhoto from given interface.
func (m *MessageActionSuggestProfilePhoto) FillFrom(from interface {
	GetPhoto() (value PhotoClass)
}) {
	m.Photo = from.GetPhoto()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionSuggestProfilePhoto) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionSuggestProfilePhoto",
		ID:   MessageActionSuggestProfilePhotoTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Photo",
			SchemaName: "photo",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionSuggestProfilePhoto) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSuggestProfilePhoto#57de635e as nil")
	}
	b.PutID(MessageActionSuggestProfilePhotoTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSuggestProfilePhoto) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSuggestProfilePhoto#57de635e as nil")
	}
	if m.Photo == nil {
		return fmt.Errorf("unable to encode messageActionSuggestProfilePhoto#57de635e: field photo is nil")
	}
	if err := m.Photo.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionSuggestProfilePhoto#57de635e: field photo: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSuggestProfilePhoto) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSuggestProfilePhoto#57de635e to nil")
	}
	if err := b.ConsumeID(MessageActionSuggestProfilePhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSuggestProfilePhoto#57de635e: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionSuggestProfilePhoto) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSuggestProfilePhoto#57de635e to nil")
	}
	{
		value, err := DecodePhoto(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSuggestProfilePhoto#57de635e: field photo: %w", err)
		}
		m.Photo = value
	}
	return nil
}

// GetPhoto returns value of Photo field.
func (m *MessageActionSuggestProfilePhoto) GetPhoto() (value PhotoClass) {
	if m == nil {
		return
	}
	return m.Photo
}

// MessageActionRequestedPeer represents TL type `messageActionRequestedPeer#fe77345d`.
// Contains info about a peer that the user shared with the bot after clicking on a
// keyboardButtonRequestPeer¹ button.
//
// Links:
//  1. https://core.telegram.org/constructor/keyboardButtonRequestPeer
//
// See https://core.telegram.org/constructor/messageActionRequestedPeer for reference.
type MessageActionRequestedPeer struct {
	// button_id contained in the keyboardButtonRequestPeer¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/keyboardButtonRequestPeer
	ButtonID int
	// The shared peer
	Peer PeerClass
}

// MessageActionRequestedPeerTypeID is TL type id of MessageActionRequestedPeer.
const MessageActionRequestedPeerTypeID = 0xfe77345d

// construct implements constructor of MessageActionClass.
func (m MessageActionRequestedPeer) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionRequestedPeer{}
)

func (m *MessageActionRequestedPeer) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.ButtonID == 0) {
		return false
	}
	if !(m.Peer == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionRequestedPeer from given interface.
func (m *MessageActionRequestedPeer) FillFrom(from interface {
	GetButtonID() (value int)
	GetPeer() (value PeerClass)
}) {
	m.ButtonID = from.GetButtonID()
	m.Peer = from.GetPeer()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionRequestedPeer) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionRequestedPeer",
		ID:   MessageActionRequestedPeerTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ButtonID",
			SchemaName: "button_id",
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionRequestedPeer) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionRequestedPeer#fe77345d as nil")
	}
	b.PutID(MessageActionRequestedPeerTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionRequestedPeer) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionRequestedPeer#fe77345d as nil")
	}
	b.PutInt(m.ButtonID)
	if m.Peer == nil {
		return fmt.Errorf("unable to encode messageActionRequestedPeer#fe77345d: field peer is nil")
	}
	if err := m.Peer.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionRequestedPeer#fe77345d: field peer: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionRequestedPeer) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionRequestedPeer#fe77345d to nil")
	}
	if err := b.ConsumeID(MessageActionRequestedPeerTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionRequestedPeer#fe77345d: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionRequestedPeer) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionRequestedPeer#fe77345d to nil")
	}
	{
		value, err := b.Int()
		if err != nil {
			return fmt.Errorf("unable to decode messageActionRequestedPeer#fe77345d: field button_id: %w", err)
		}
		m.ButtonID = value
	}
	{
		value, err := DecodePeer(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionRequestedPeer#fe77345d: field peer: %w", err)
		}
		m.Peer = value
	}
	return nil
}

// GetButtonID returns value of ButtonID field.
func (m *MessageActionRequestedPeer) GetButtonID() (value int) {
	if m == nil {
		return
	}
	return m.ButtonID
}

// GetPeer returns value of Peer field.
func (m *MessageActionRequestedPeer) GetPeer() (value PeerClass) {
	if m == nil {
		return
	}
	return m.Peer
}

// MessageActionSetChatWallPaper represents TL type `messageActionSetChatWallPaper#bc44a927`.
// The wallpaper »¹ of the current chat was changed.
//
// Links:
//  1. https://core.telegram.org/api/wallpapers
//
// See https://core.telegram.org/constructor/messageActionSetChatWallPaper for reference.
type MessageActionSetChatWallPaper struct {
	// New wallpaper¹
	//
	// Links:
	//  1) https://core.telegram.org/api/wallpapers
	Wallpaper WallPaperClass
}

// MessageActionSetChatWallPaperTypeID is TL type id of MessageActionSetChatWallPaper.
const MessageActionSetChatWallPaperTypeID = 0xbc44a927

// construct implements constructor of MessageActionClass.
func (m MessageActionSetChatWallPaper) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSetChatWallPaper{}
)

func (m *MessageActionSetChatWallPaper) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Wallpaper == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionSetChatWallPaper from given interface.
func (m *MessageActionSetChatWallPaper) FillFrom(from interface {
	GetWallpaper() (value WallPaperClass)
}) {
	m.Wallpaper = from.GetWallpaper()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionSetChatWallPaper) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionSetChatWallPaper",
		ID:   MessageActionSetChatWallPaperTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Wallpaper",
			SchemaName: "wallpaper",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionSetChatWallPaper) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetChatWallPaper#bc44a927 as nil")
	}
	b.PutID(MessageActionSetChatWallPaperTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSetChatWallPaper) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetChatWallPaper#bc44a927 as nil")
	}
	if m.Wallpaper == nil {
		return fmt.Errorf("unable to encode messageActionSetChatWallPaper#bc44a927: field wallpaper is nil")
	}
	if err := m.Wallpaper.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionSetChatWallPaper#bc44a927: field wallpaper: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSetChatWallPaper) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetChatWallPaper#bc44a927 to nil")
	}
	if err := b.ConsumeID(MessageActionSetChatWallPaperTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSetChatWallPaper#bc44a927: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionSetChatWallPaper) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetChatWallPaper#bc44a927 to nil")
	}
	{
		value, err := DecodeWallPaper(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSetChatWallPaper#bc44a927: field wallpaper: %w", err)
		}
		m.Wallpaper = value
	}
	return nil
}

// GetWallpaper returns value of Wallpaper field.
func (m *MessageActionSetChatWallPaper) GetWallpaper() (value WallPaperClass) {
	if m == nil {
		return
	}
	return m.Wallpaper
}

// MessageActionSetSameChatWallPaper represents TL type `messageActionSetSameChatWallPaper#c0787d6d`.
// The user applied a wallpaper »¹ previously sent by the other user in a
// messageActionSetChatWallPaper² message.
//
// Links:
//  1. https://core.telegram.org/api/wallpapers
//  2. https://core.telegram.org/constructor/messageActionSetChatWallPaper
//
// See https://core.telegram.org/constructor/messageActionSetSameChatWallPaper for reference.
type MessageActionSetSameChatWallPaper struct {
	// The wallpaper¹
	//
	// Links:
	//  1) https://core.telegram.org/api/wallpapers
	Wallpaper WallPaperClass
}

// MessageActionSetSameChatWallPaperTypeID is TL type id of MessageActionSetSameChatWallPaper.
const MessageActionSetSameChatWallPaperTypeID = 0xc0787d6d

// construct implements constructor of MessageActionClass.
func (m MessageActionSetSameChatWallPaper) construct() MessageActionClass { return &m }

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

	_ MessageActionClass = &MessageActionSetSameChatWallPaper{}
)

func (m *MessageActionSetSameChatWallPaper) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.Wallpaper == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageActionSetSameChatWallPaper from given interface.
func (m *MessageActionSetSameChatWallPaper) FillFrom(from interface {
	GetWallpaper() (value WallPaperClass)
}) {
	m.Wallpaper = from.GetWallpaper()
}

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

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

// TypeInfo returns info about TL type.
func (m *MessageActionSetSameChatWallPaper) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageActionSetSameChatWallPaper",
		ID:   MessageActionSetSameChatWallPaperTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Wallpaper",
			SchemaName: "wallpaper",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageActionSetSameChatWallPaper) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetSameChatWallPaper#c0787d6d as nil")
	}
	b.PutID(MessageActionSetSameChatWallPaperTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageActionSetSameChatWallPaper) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageActionSetSameChatWallPaper#c0787d6d as nil")
	}
	if m.Wallpaper == nil {
		return fmt.Errorf("unable to encode messageActionSetSameChatWallPaper#c0787d6d: field wallpaper is nil")
	}
	if err := m.Wallpaper.Encode(b); err != nil {
		return fmt.Errorf("unable to encode messageActionSetSameChatWallPaper#c0787d6d: field wallpaper: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (m *MessageActionSetSameChatWallPaper) Decode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetSameChatWallPaper#c0787d6d to nil")
	}
	if err := b.ConsumeID(MessageActionSetSameChatWallPaperTypeID); err != nil {
		return fmt.Errorf("unable to decode messageActionSetSameChatWallPaper#c0787d6d: %w", err)
	}
	return m.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (m *MessageActionSetSameChatWallPaper) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageActionSetSameChatWallPaper#c0787d6d to nil")
	}
	{
		value, err := DecodeWallPaper(b)
		if err != nil {
			return fmt.Errorf("unable to decode messageActionSetSameChatWallPaper#c0787d6d: field wallpaper: %w", err)
		}
		m.Wallpaper = value
	}
	return nil
}

// GetWallpaper returns value of Wallpaper field.
func (m *MessageActionSetSameChatWallPaper) GetWallpaper() (value WallPaperClass) {
	if m == nil {
		return
	}
	return m.Wallpaper
}

// MessageActionClassName is schema name of MessageActionClass.
const MessageActionClassName = "MessageAction"

// MessageActionClass represents MessageAction generic type.
//
// See https://core.telegram.org/type/MessageAction for reference.
//
// Example:
//
//	g, err := tg.DecodeMessageAction(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessageActionEmpty: // messageActionEmpty#b6aef7b0
//	case *tg.MessageActionChatCreate: // messageActionChatCreate#bd47cbad
//	case *tg.MessageActionChatEditTitle: // messageActionChatEditTitle#b5a1ce5a
//	case *tg.MessageActionChatEditPhoto: // messageActionChatEditPhoto#7fcb13a8
//	case *tg.MessageActionChatDeletePhoto: // messageActionChatDeletePhoto#95e3fbef
//	case *tg.MessageActionChatAddUser: // messageActionChatAddUser#15cefd00
//	case *tg.MessageActionChatDeleteUser: // messageActionChatDeleteUser#a43f30cc
//	case *tg.MessageActionChatJoinedByLink: // messageActionChatJoinedByLink#31224c3
//	case *tg.MessageActionChannelCreate: // messageActionChannelCreate#95d2ac92
//	case *tg.MessageActionChatMigrateTo: // messageActionChatMigrateTo#e1037f92
//	case *tg.MessageActionChannelMigrateFrom: // messageActionChannelMigrateFrom#ea3948e9
//	case *tg.MessageActionPinMessage: // messageActionPinMessage#94bd38ed
//	case *tg.MessageActionHistoryClear: // messageActionHistoryClear#9fbab604
//	case *tg.MessageActionGameScore: // messageActionGameScore#92a72876
//	case *tg.MessageActionPaymentSentMe: // messageActionPaymentSentMe#8f31b327
//	case *tg.MessageActionPaymentSent: // messageActionPaymentSent#96163f56
//	case *tg.MessageActionPhoneCall: // messageActionPhoneCall#80e11a7f
//	case *tg.MessageActionScreenshotTaken: // messageActionScreenshotTaken#4792929b
//	case *tg.MessageActionCustomAction: // messageActionCustomAction#fae69f56
//	case *tg.MessageActionBotAllowed: // messageActionBotAllowed#c516d679
//	case *tg.MessageActionSecureValuesSentMe: // messageActionSecureValuesSentMe#1b287353
//	case *tg.MessageActionSecureValuesSent: // messageActionSecureValuesSent#d95c6154
//	case *tg.MessageActionContactSignUp: // messageActionContactSignUp#f3f25f76
//	case *tg.MessageActionGeoProximityReached: // messageActionGeoProximityReached#98e0d697
//	case *tg.MessageActionGroupCall: // messageActionGroupCall#7a0d7f42
//	case *tg.MessageActionInviteToGroupCall: // messageActionInviteToGroupCall#502f92f7
//	case *tg.MessageActionSetMessagesTTL: // messageActionSetMessagesTTL#3c134d7b
//	case *tg.MessageActionGroupCallScheduled: // messageActionGroupCallScheduled#b3a07661
//	case *tg.MessageActionSetChatTheme: // messageActionSetChatTheme#aa786345
//	case *tg.MessageActionChatJoinedByRequest: // messageActionChatJoinedByRequest#ebbca3cb
//	case *tg.MessageActionWebViewDataSentMe: // messageActionWebViewDataSentMe#47dd8079
//	case *tg.MessageActionWebViewDataSent: // messageActionWebViewDataSent#b4c38cb5
//	case *tg.MessageActionGiftPremium: // messageActionGiftPremium#c83d6aec
//	case *tg.MessageActionTopicCreate: // messageActionTopicCreate#d999256
//	case *tg.MessageActionTopicEdit: // messageActionTopicEdit#c0944820
//	case *tg.MessageActionSuggestProfilePhoto: // messageActionSuggestProfilePhoto#57de635e
//	case *tg.MessageActionRequestedPeer: // messageActionRequestedPeer#fe77345d
//	case *tg.MessageActionSetChatWallPaper: // messageActionSetChatWallPaper#bc44a927
//	case *tg.MessageActionSetSameChatWallPaper: // messageActionSetSameChatWallPaper#c0787d6d
//	default: panic(v)
//	}
type MessageActionClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessageActionClass

	// 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
}

// DecodeMessageAction implements binary de-serialization for MessageActionClass.
func DecodeMessageAction(buf *bin.Buffer) (MessageActionClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case MessageActionEmptyTypeID:
		// Decoding messageActionEmpty#b6aef7b0.
		v := MessageActionEmpty{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatCreateTypeID:
		// Decoding messageActionChatCreate#bd47cbad.
		v := MessageActionChatCreate{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatEditTitleTypeID:
		// Decoding messageActionChatEditTitle#b5a1ce5a.
		v := MessageActionChatEditTitle{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatEditPhotoTypeID:
		// Decoding messageActionChatEditPhoto#7fcb13a8.
		v := MessageActionChatEditPhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatDeletePhotoTypeID:
		// Decoding messageActionChatDeletePhoto#95e3fbef.
		v := MessageActionChatDeletePhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatAddUserTypeID:
		// Decoding messageActionChatAddUser#15cefd00.
		v := MessageActionChatAddUser{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatDeleteUserTypeID:
		// Decoding messageActionChatDeleteUser#a43f30cc.
		v := MessageActionChatDeleteUser{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatJoinedByLinkTypeID:
		// Decoding messageActionChatJoinedByLink#31224c3.
		v := MessageActionChatJoinedByLink{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChannelCreateTypeID:
		// Decoding messageActionChannelCreate#95d2ac92.
		v := MessageActionChannelCreate{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatMigrateToTypeID:
		// Decoding messageActionChatMigrateTo#e1037f92.
		v := MessageActionChatMigrateTo{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChannelMigrateFromTypeID:
		// Decoding messageActionChannelMigrateFrom#ea3948e9.
		v := MessageActionChannelMigrateFrom{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionPinMessageTypeID:
		// Decoding messageActionPinMessage#94bd38ed.
		v := MessageActionPinMessage{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionHistoryClearTypeID:
		// Decoding messageActionHistoryClear#9fbab604.
		v := MessageActionHistoryClear{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionGameScoreTypeID:
		// Decoding messageActionGameScore#92a72876.
		v := MessageActionGameScore{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionPaymentSentMeTypeID:
		// Decoding messageActionPaymentSentMe#8f31b327.
		v := MessageActionPaymentSentMe{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionPaymentSentTypeID:
		// Decoding messageActionPaymentSent#96163f56.
		v := MessageActionPaymentSent{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionPhoneCallTypeID:
		// Decoding messageActionPhoneCall#80e11a7f.
		v := MessageActionPhoneCall{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionScreenshotTakenTypeID:
		// Decoding messageActionScreenshotTaken#4792929b.
		v := MessageActionScreenshotTaken{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionCustomActionTypeID:
		// Decoding messageActionCustomAction#fae69f56.
		v := MessageActionCustomAction{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionBotAllowedTypeID:
		// Decoding messageActionBotAllowed#c516d679.
		v := MessageActionBotAllowed{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSecureValuesSentMeTypeID:
		// Decoding messageActionSecureValuesSentMe#1b287353.
		v := MessageActionSecureValuesSentMe{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSecureValuesSentTypeID:
		// Decoding messageActionSecureValuesSent#d95c6154.
		v := MessageActionSecureValuesSent{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionContactSignUpTypeID:
		// Decoding messageActionContactSignUp#f3f25f76.
		v := MessageActionContactSignUp{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionGeoProximityReachedTypeID:
		// Decoding messageActionGeoProximityReached#98e0d697.
		v := MessageActionGeoProximityReached{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionGroupCallTypeID:
		// Decoding messageActionGroupCall#7a0d7f42.
		v := MessageActionGroupCall{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionInviteToGroupCallTypeID:
		// Decoding messageActionInviteToGroupCall#502f92f7.
		v := MessageActionInviteToGroupCall{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSetMessagesTTLTypeID:
		// Decoding messageActionSetMessagesTTL#3c134d7b.
		v := MessageActionSetMessagesTTL{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionGroupCallScheduledTypeID:
		// Decoding messageActionGroupCallScheduled#b3a07661.
		v := MessageActionGroupCallScheduled{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSetChatThemeTypeID:
		// Decoding messageActionSetChatTheme#aa786345.
		v := MessageActionSetChatTheme{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionChatJoinedByRequestTypeID:
		// Decoding messageActionChatJoinedByRequest#ebbca3cb.
		v := MessageActionChatJoinedByRequest{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionWebViewDataSentMeTypeID:
		// Decoding messageActionWebViewDataSentMe#47dd8079.
		v := MessageActionWebViewDataSentMe{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionWebViewDataSentTypeID:
		// Decoding messageActionWebViewDataSent#b4c38cb5.
		v := MessageActionWebViewDataSent{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionGiftPremiumTypeID:
		// Decoding messageActionGiftPremium#c83d6aec.
		v := MessageActionGiftPremium{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionTopicCreateTypeID:
		// Decoding messageActionTopicCreate#d999256.
		v := MessageActionTopicCreate{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionTopicEditTypeID:
		// Decoding messageActionTopicEdit#c0944820.
		v := MessageActionTopicEdit{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSuggestProfilePhotoTypeID:
		// Decoding messageActionSuggestProfilePhoto#57de635e.
		v := MessageActionSuggestProfilePhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionRequestedPeerTypeID:
		// Decoding messageActionRequestedPeer#fe77345d.
		v := MessageActionRequestedPeer{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSetChatWallPaperTypeID:
		// Decoding messageActionSetChatWallPaper#bc44a927.
		v := MessageActionSetChatWallPaper{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	case MessageActionSetSameChatWallPaperTypeID:
		// Decoding messageActionSetSameChatWallPaper#c0787d6d.
		v := MessageActionSetSameChatWallPaper{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode MessageActionClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode MessageActionClass: %w", bin.NewUnexpectedID(id))
	}
}

// MessageAction boxes the MessageActionClass providing a helper.
type MessageActionBox struct {
	MessageAction MessageActionClass
}

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

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