// Code generated by gotdgen, DO NOT EDIT.

package tdapi

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

	"go.uber.org/multierr"

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

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

// MessageProperties represents TL type `messageProperties#e9f1ca48`.
type MessageProperties struct {
	// True, if content of the message can be copied using inputMessageForwarded or
	// forwardMessages with copy options
	CanBeCopied bool
	// True, if content of the message can be copied to a secret chat using
	// inputMessageForwarded or forwardMessages with copy options
	CanBeCopiedToSecretChat bool
	// True, if the message can be deleted only for the current user while other users will
	// continue to see it using the method deleteMessages with revoke == false
	CanBeDeletedOnlyForSelf bool
	// True, if the message can be deleted for all users using the method deleteMessages with
	// revoke == true
	CanBeDeletedForAllUsers bool
	// True, if the message can be edited using the methods editMessageText,
	// editMessageCaption, or editMessageReplyMarkup.
	CanBeEdited bool
	// True, if the message can be forwarded using inputMessageForwarded or forwardMessages
	// without copy options
	CanBeForwarded bool
	// True, if the message can be paid using inputInvoiceMessage
	CanBePaid bool
	// True, if the message can be pinned or unpinned in the chat using pinChatMessage or
	// unpinChatMessage
	CanBePinned bool
	// True, if the message can be replied in the same chat and forum topic using
	// inputMessageReplyToMessage
	CanBeReplied bool
	// True, if the message can be replied in another chat or forum topic using
	// inputMessageReplyToExternalMessage
	CanBeRepliedInAnotherChat bool
	// True, if content of the message can be saved locally
	CanBeSaved bool
	// True, if the message can be shared in a story using inputStoryAreaTypeMessage
	CanBeSharedInStory bool
	// True, if the message can be edited using the method editMessageMedia
	CanEditMedia bool
	// True, if scheduling state of the message can be edited
	CanEditSchedulingState bool
	// True, if author of the message sent on behalf of a chat can be received through
	// getMessageAuthor
	CanGetAuthor bool
	// True, if code for message embedding can be received using getMessageEmbeddingCode
	CanGetEmbeddingCode bool
	// True, if a link can be generated for the message using getMessageLink
	CanGetLink bool
	// True, if media timestamp links can be generated for media timestamp entities in the
	// message text, caption or link preview description using getMessageLink
	CanGetMediaTimestampLinks bool
	// True, if information about the message thread is available through getMessageThread
	// and getMessageThreadHistory
	CanGetMessageThread bool
	// True, if read date of the message can be received through getMessageReadDate
	CanGetReadDate bool
	// True, if message statistics are available through getMessageStatistics and message
	// forwards can be received using getMessagePublicForwards
	CanGetStatistics bool
	// True, if chat members already viewed the message can be received through
	// getMessageViewers
	CanGetViewers bool
	// True, if speech can be recognized for the message through recognizeSpeech
	CanRecognizeSpeech bool
	// True, if the message can be reported using reportChat
	CanReportChat bool
	// True, if reactions on the message can be reported through reportMessageReactions
	CanReportReactions bool
	// True, if the message can be reported using reportSupergroupSpam
	CanReportSupergroupSpam bool
	// True, if fact check for the message can be changed through setMessageFactCheck
	CanSetFactCheck bool
	// True, if message statistics must be available from context menu of the message
	NeedShowStatistics bool
}

// MessagePropertiesTypeID is TL type id of MessageProperties.
const MessagePropertiesTypeID = 0xe9f1ca48

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

func (m *MessageProperties) Zero() bool {
	if m == nil {
		return true
	}
	if !(m.CanBeCopied == false) {
		return false
	}
	if !(m.CanBeCopiedToSecretChat == false) {
		return false
	}
	if !(m.CanBeDeletedOnlyForSelf == false) {
		return false
	}
	if !(m.CanBeDeletedForAllUsers == false) {
		return false
	}
	if !(m.CanBeEdited == false) {
		return false
	}
	if !(m.CanBeForwarded == false) {
		return false
	}
	if !(m.CanBePaid == false) {
		return false
	}
	if !(m.CanBePinned == false) {
		return false
	}
	if !(m.CanBeReplied == false) {
		return false
	}
	if !(m.CanBeRepliedInAnotherChat == false) {
		return false
	}
	if !(m.CanBeSaved == false) {
		return false
	}
	if !(m.CanBeSharedInStory == false) {
		return false
	}
	if !(m.CanEditMedia == false) {
		return false
	}
	if !(m.CanEditSchedulingState == false) {
		return false
	}
	if !(m.CanGetAuthor == false) {
		return false
	}
	if !(m.CanGetEmbeddingCode == false) {
		return false
	}
	if !(m.CanGetLink == false) {
		return false
	}
	if !(m.CanGetMediaTimestampLinks == false) {
		return false
	}
	if !(m.CanGetMessageThread == false) {
		return false
	}
	if !(m.CanGetReadDate == false) {
		return false
	}
	if !(m.CanGetStatistics == false) {
		return false
	}
	if !(m.CanGetViewers == false) {
		return false
	}
	if !(m.CanRecognizeSpeech == false) {
		return false
	}
	if !(m.CanReportChat == false) {
		return false
	}
	if !(m.CanReportReactions == false) {
		return false
	}
	if !(m.CanReportSupergroupSpam == false) {
		return false
	}
	if !(m.CanSetFactCheck == false) {
		return false
	}
	if !(m.NeedShowStatistics == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (m *MessageProperties) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "messageProperties",
		ID:   MessagePropertiesTypeID,
	}
	if m == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "CanBeCopied",
			SchemaName: "can_be_copied",
		},
		{
			Name:       "CanBeCopiedToSecretChat",
			SchemaName: "can_be_copied_to_secret_chat",
		},
		{
			Name:       "CanBeDeletedOnlyForSelf",
			SchemaName: "can_be_deleted_only_for_self",
		},
		{
			Name:       "CanBeDeletedForAllUsers",
			SchemaName: "can_be_deleted_for_all_users",
		},
		{
			Name:       "CanBeEdited",
			SchemaName: "can_be_edited",
		},
		{
			Name:       "CanBeForwarded",
			SchemaName: "can_be_forwarded",
		},
		{
			Name:       "CanBePaid",
			SchemaName: "can_be_paid",
		},
		{
			Name:       "CanBePinned",
			SchemaName: "can_be_pinned",
		},
		{
			Name:       "CanBeReplied",
			SchemaName: "can_be_replied",
		},
		{
			Name:       "CanBeRepliedInAnotherChat",
			SchemaName: "can_be_replied_in_another_chat",
		},
		{
			Name:       "CanBeSaved",
			SchemaName: "can_be_saved",
		},
		{
			Name:       "CanBeSharedInStory",
			SchemaName: "can_be_shared_in_story",
		},
		{
			Name:       "CanEditMedia",
			SchemaName: "can_edit_media",
		},
		{
			Name:       "CanEditSchedulingState",
			SchemaName: "can_edit_scheduling_state",
		},
		{
			Name:       "CanGetAuthor",
			SchemaName: "can_get_author",
		},
		{
			Name:       "CanGetEmbeddingCode",
			SchemaName: "can_get_embedding_code",
		},
		{
			Name:       "CanGetLink",
			SchemaName: "can_get_link",
		},
		{
			Name:       "CanGetMediaTimestampLinks",
			SchemaName: "can_get_media_timestamp_links",
		},
		{
			Name:       "CanGetMessageThread",
			SchemaName: "can_get_message_thread",
		},
		{
			Name:       "CanGetReadDate",
			SchemaName: "can_get_read_date",
		},
		{
			Name:       "CanGetStatistics",
			SchemaName: "can_get_statistics",
		},
		{
			Name:       "CanGetViewers",
			SchemaName: "can_get_viewers",
		},
		{
			Name:       "CanRecognizeSpeech",
			SchemaName: "can_recognize_speech",
		},
		{
			Name:       "CanReportChat",
			SchemaName: "can_report_chat",
		},
		{
			Name:       "CanReportReactions",
			SchemaName: "can_report_reactions",
		},
		{
			Name:       "CanReportSupergroupSpam",
			SchemaName: "can_report_supergroup_spam",
		},
		{
			Name:       "CanSetFactCheck",
			SchemaName: "can_set_fact_check",
		},
		{
			Name:       "NeedShowStatistics",
			SchemaName: "need_show_statistics",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (m *MessageProperties) Encode(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageProperties#e9f1ca48 as nil")
	}
	b.PutID(MessagePropertiesTypeID)
	return m.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (m *MessageProperties) EncodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't encode messageProperties#e9f1ca48 as nil")
	}
	b.PutBool(m.CanBeCopied)
	b.PutBool(m.CanBeCopiedToSecretChat)
	b.PutBool(m.CanBeDeletedOnlyForSelf)
	b.PutBool(m.CanBeDeletedForAllUsers)
	b.PutBool(m.CanBeEdited)
	b.PutBool(m.CanBeForwarded)
	b.PutBool(m.CanBePaid)
	b.PutBool(m.CanBePinned)
	b.PutBool(m.CanBeReplied)
	b.PutBool(m.CanBeRepliedInAnotherChat)
	b.PutBool(m.CanBeSaved)
	b.PutBool(m.CanBeSharedInStory)
	b.PutBool(m.CanEditMedia)
	b.PutBool(m.CanEditSchedulingState)
	b.PutBool(m.CanGetAuthor)
	b.PutBool(m.CanGetEmbeddingCode)
	b.PutBool(m.CanGetLink)
	b.PutBool(m.CanGetMediaTimestampLinks)
	b.PutBool(m.CanGetMessageThread)
	b.PutBool(m.CanGetReadDate)
	b.PutBool(m.CanGetStatistics)
	b.PutBool(m.CanGetViewers)
	b.PutBool(m.CanRecognizeSpeech)
	b.PutBool(m.CanReportChat)
	b.PutBool(m.CanReportReactions)
	b.PutBool(m.CanReportSupergroupSpam)
	b.PutBool(m.CanSetFactCheck)
	b.PutBool(m.NeedShowStatistics)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (m *MessageProperties) DecodeBare(b *bin.Buffer) error {
	if m == nil {
		return fmt.Errorf("can't decode messageProperties#e9f1ca48 to nil")
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_copied: %w", err)
		}
		m.CanBeCopied = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_copied_to_secret_chat: %w", err)
		}
		m.CanBeCopiedToSecretChat = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_deleted_only_for_self: %w", err)
		}
		m.CanBeDeletedOnlyForSelf = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_deleted_for_all_users: %w", err)
		}
		m.CanBeDeletedForAllUsers = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_edited: %w", err)
		}
		m.CanBeEdited = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_forwarded: %w", err)
		}
		m.CanBeForwarded = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_paid: %w", err)
		}
		m.CanBePaid = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_pinned: %w", err)
		}
		m.CanBePinned = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_replied: %w", err)
		}
		m.CanBeReplied = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_replied_in_another_chat: %w", err)
		}
		m.CanBeRepliedInAnotherChat = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_saved: %w", err)
		}
		m.CanBeSaved = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_shared_in_story: %w", err)
		}
		m.CanBeSharedInStory = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_edit_media: %w", err)
		}
		m.CanEditMedia = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_edit_scheduling_state: %w", err)
		}
		m.CanEditSchedulingState = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_author: %w", err)
		}
		m.CanGetAuthor = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_embedding_code: %w", err)
		}
		m.CanGetEmbeddingCode = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_link: %w", err)
		}
		m.CanGetLink = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_media_timestamp_links: %w", err)
		}
		m.CanGetMediaTimestampLinks = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_message_thread: %w", err)
		}
		m.CanGetMessageThread = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_read_date: %w", err)
		}
		m.CanGetReadDate = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_statistics: %w", err)
		}
		m.CanGetStatistics = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_viewers: %w", err)
		}
		m.CanGetViewers = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_recognize_speech: %w", err)
		}
		m.CanRecognizeSpeech = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_report_chat: %w", err)
		}
		m.CanReportChat = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_report_reactions: %w", err)
		}
		m.CanReportReactions = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_report_supergroup_spam: %w", err)
		}
		m.CanReportSupergroupSpam = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_set_fact_check: %w", err)
		}
		m.CanSetFactCheck = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field need_show_statistics: %w", err)
		}
		m.NeedShowStatistics = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (m *MessageProperties) EncodeTDLibJSON(b tdjson.Encoder) error {
	if m == nil {
		return fmt.Errorf("can't encode messageProperties#e9f1ca48 as nil")
	}
	b.ObjStart()
	b.PutID("messageProperties")
	b.Comma()
	b.FieldStart("can_be_copied")
	b.PutBool(m.CanBeCopied)
	b.Comma()
	b.FieldStart("can_be_copied_to_secret_chat")
	b.PutBool(m.CanBeCopiedToSecretChat)
	b.Comma()
	b.FieldStart("can_be_deleted_only_for_self")
	b.PutBool(m.CanBeDeletedOnlyForSelf)
	b.Comma()
	b.FieldStart("can_be_deleted_for_all_users")
	b.PutBool(m.CanBeDeletedForAllUsers)
	b.Comma()
	b.FieldStart("can_be_edited")
	b.PutBool(m.CanBeEdited)
	b.Comma()
	b.FieldStart("can_be_forwarded")
	b.PutBool(m.CanBeForwarded)
	b.Comma()
	b.FieldStart("can_be_paid")
	b.PutBool(m.CanBePaid)
	b.Comma()
	b.FieldStart("can_be_pinned")
	b.PutBool(m.CanBePinned)
	b.Comma()
	b.FieldStart("can_be_replied")
	b.PutBool(m.CanBeReplied)
	b.Comma()
	b.FieldStart("can_be_replied_in_another_chat")
	b.PutBool(m.CanBeRepliedInAnotherChat)
	b.Comma()
	b.FieldStart("can_be_saved")
	b.PutBool(m.CanBeSaved)
	b.Comma()
	b.FieldStart("can_be_shared_in_story")
	b.PutBool(m.CanBeSharedInStory)
	b.Comma()
	b.FieldStart("can_edit_media")
	b.PutBool(m.CanEditMedia)
	b.Comma()
	b.FieldStart("can_edit_scheduling_state")
	b.PutBool(m.CanEditSchedulingState)
	b.Comma()
	b.FieldStart("can_get_author")
	b.PutBool(m.CanGetAuthor)
	b.Comma()
	b.FieldStart("can_get_embedding_code")
	b.PutBool(m.CanGetEmbeddingCode)
	b.Comma()
	b.FieldStart("can_get_link")
	b.PutBool(m.CanGetLink)
	b.Comma()
	b.FieldStart("can_get_media_timestamp_links")
	b.PutBool(m.CanGetMediaTimestampLinks)
	b.Comma()
	b.FieldStart("can_get_message_thread")
	b.PutBool(m.CanGetMessageThread)
	b.Comma()
	b.FieldStart("can_get_read_date")
	b.PutBool(m.CanGetReadDate)
	b.Comma()
	b.FieldStart("can_get_statistics")
	b.PutBool(m.CanGetStatistics)
	b.Comma()
	b.FieldStart("can_get_viewers")
	b.PutBool(m.CanGetViewers)
	b.Comma()
	b.FieldStart("can_recognize_speech")
	b.PutBool(m.CanRecognizeSpeech)
	b.Comma()
	b.FieldStart("can_report_chat")
	b.PutBool(m.CanReportChat)
	b.Comma()
	b.FieldStart("can_report_reactions")
	b.PutBool(m.CanReportReactions)
	b.Comma()
	b.FieldStart("can_report_supergroup_spam")
	b.PutBool(m.CanReportSupergroupSpam)
	b.Comma()
	b.FieldStart("can_set_fact_check")
	b.PutBool(m.CanSetFactCheck)
	b.Comma()
	b.FieldStart("need_show_statistics")
	b.PutBool(m.NeedShowStatistics)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (m *MessageProperties) DecodeTDLibJSON(b tdjson.Decoder) error {
	if m == nil {
		return fmt.Errorf("can't decode messageProperties#e9f1ca48 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("messageProperties"); err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: %w", err)
			}
		case "can_be_copied":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_copied: %w", err)
			}
			m.CanBeCopied = value
		case "can_be_copied_to_secret_chat":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_copied_to_secret_chat: %w", err)
			}
			m.CanBeCopiedToSecretChat = value
		case "can_be_deleted_only_for_self":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_deleted_only_for_self: %w", err)
			}
			m.CanBeDeletedOnlyForSelf = value
		case "can_be_deleted_for_all_users":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_deleted_for_all_users: %w", err)
			}
			m.CanBeDeletedForAllUsers = value
		case "can_be_edited":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_edited: %w", err)
			}
			m.CanBeEdited = value
		case "can_be_forwarded":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_forwarded: %w", err)
			}
			m.CanBeForwarded = value
		case "can_be_paid":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_paid: %w", err)
			}
			m.CanBePaid = value
		case "can_be_pinned":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_pinned: %w", err)
			}
			m.CanBePinned = value
		case "can_be_replied":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_replied: %w", err)
			}
			m.CanBeReplied = value
		case "can_be_replied_in_another_chat":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_replied_in_another_chat: %w", err)
			}
			m.CanBeRepliedInAnotherChat = value
		case "can_be_saved":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_saved: %w", err)
			}
			m.CanBeSaved = value
		case "can_be_shared_in_story":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_be_shared_in_story: %w", err)
			}
			m.CanBeSharedInStory = value
		case "can_edit_media":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_edit_media: %w", err)
			}
			m.CanEditMedia = value
		case "can_edit_scheduling_state":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_edit_scheduling_state: %w", err)
			}
			m.CanEditSchedulingState = value
		case "can_get_author":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_author: %w", err)
			}
			m.CanGetAuthor = value
		case "can_get_embedding_code":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_embedding_code: %w", err)
			}
			m.CanGetEmbeddingCode = value
		case "can_get_link":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_link: %w", err)
			}
			m.CanGetLink = value
		case "can_get_media_timestamp_links":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_media_timestamp_links: %w", err)
			}
			m.CanGetMediaTimestampLinks = value
		case "can_get_message_thread":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_message_thread: %w", err)
			}
			m.CanGetMessageThread = value
		case "can_get_read_date":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_read_date: %w", err)
			}
			m.CanGetReadDate = value
		case "can_get_statistics":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_statistics: %w", err)
			}
			m.CanGetStatistics = value
		case "can_get_viewers":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_get_viewers: %w", err)
			}
			m.CanGetViewers = value
		case "can_recognize_speech":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_recognize_speech: %w", err)
			}
			m.CanRecognizeSpeech = value
		case "can_report_chat":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_report_chat: %w", err)
			}
			m.CanReportChat = value
		case "can_report_reactions":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_report_reactions: %w", err)
			}
			m.CanReportReactions = value
		case "can_report_supergroup_spam":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_report_supergroup_spam: %w", err)
			}
			m.CanReportSupergroupSpam = value
		case "can_set_fact_check":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field can_set_fact_check: %w", err)
			}
			m.CanSetFactCheck = value
		case "need_show_statistics":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode messageProperties#e9f1ca48: field need_show_statistics: %w", err)
			}
			m.NeedShowStatistics = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetCanBeCopied returns value of CanBeCopied field.
func (m *MessageProperties) GetCanBeCopied() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeCopied
}

// GetCanBeCopiedToSecretChat returns value of CanBeCopiedToSecretChat field.
func (m *MessageProperties) GetCanBeCopiedToSecretChat() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeCopiedToSecretChat
}

// GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field.
func (m *MessageProperties) GetCanBeDeletedOnlyForSelf() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeDeletedOnlyForSelf
}

// GetCanBeDeletedForAllUsers returns value of CanBeDeletedForAllUsers field.
func (m *MessageProperties) GetCanBeDeletedForAllUsers() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeDeletedForAllUsers
}

// GetCanBeEdited returns value of CanBeEdited field.
func (m *MessageProperties) GetCanBeEdited() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeEdited
}

// GetCanBeForwarded returns value of CanBeForwarded field.
func (m *MessageProperties) GetCanBeForwarded() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeForwarded
}

// GetCanBePaid returns value of CanBePaid field.
func (m *MessageProperties) GetCanBePaid() (value bool) {
	if m == nil {
		return
	}
	return m.CanBePaid
}

// GetCanBePinned returns value of CanBePinned field.
func (m *MessageProperties) GetCanBePinned() (value bool) {
	if m == nil {
		return
	}
	return m.CanBePinned
}

// GetCanBeReplied returns value of CanBeReplied field.
func (m *MessageProperties) GetCanBeReplied() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeReplied
}

// GetCanBeRepliedInAnotherChat returns value of CanBeRepliedInAnotherChat field.
func (m *MessageProperties) GetCanBeRepliedInAnotherChat() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeRepliedInAnotherChat
}

// GetCanBeSaved returns value of CanBeSaved field.
func (m *MessageProperties) GetCanBeSaved() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeSaved
}

// GetCanBeSharedInStory returns value of CanBeSharedInStory field.
func (m *MessageProperties) GetCanBeSharedInStory() (value bool) {
	if m == nil {
		return
	}
	return m.CanBeSharedInStory
}

// GetCanEditMedia returns value of CanEditMedia field.
func (m *MessageProperties) GetCanEditMedia() (value bool) {
	if m == nil {
		return
	}
	return m.CanEditMedia
}

// GetCanEditSchedulingState returns value of CanEditSchedulingState field.
func (m *MessageProperties) GetCanEditSchedulingState() (value bool) {
	if m == nil {
		return
	}
	return m.CanEditSchedulingState
}

// GetCanGetAuthor returns value of CanGetAuthor field.
func (m *MessageProperties) GetCanGetAuthor() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetAuthor
}

// GetCanGetEmbeddingCode returns value of CanGetEmbeddingCode field.
func (m *MessageProperties) GetCanGetEmbeddingCode() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetEmbeddingCode
}

// GetCanGetLink returns value of CanGetLink field.
func (m *MessageProperties) GetCanGetLink() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetLink
}

// GetCanGetMediaTimestampLinks returns value of CanGetMediaTimestampLinks field.
func (m *MessageProperties) GetCanGetMediaTimestampLinks() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetMediaTimestampLinks
}

// GetCanGetMessageThread returns value of CanGetMessageThread field.
func (m *MessageProperties) GetCanGetMessageThread() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetMessageThread
}

// GetCanGetReadDate returns value of CanGetReadDate field.
func (m *MessageProperties) GetCanGetReadDate() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetReadDate
}

// GetCanGetStatistics returns value of CanGetStatistics field.
func (m *MessageProperties) GetCanGetStatistics() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetStatistics
}

// GetCanGetViewers returns value of CanGetViewers field.
func (m *MessageProperties) GetCanGetViewers() (value bool) {
	if m == nil {
		return
	}
	return m.CanGetViewers
}

// GetCanRecognizeSpeech returns value of CanRecognizeSpeech field.
func (m *MessageProperties) GetCanRecognizeSpeech() (value bool) {
	if m == nil {
		return
	}
	return m.CanRecognizeSpeech
}

// GetCanReportChat returns value of CanReportChat field.
func (m *MessageProperties) GetCanReportChat() (value bool) {
	if m == nil {
		return
	}
	return m.CanReportChat
}

// GetCanReportReactions returns value of CanReportReactions field.
func (m *MessageProperties) GetCanReportReactions() (value bool) {
	if m == nil {
		return
	}
	return m.CanReportReactions
}

// GetCanReportSupergroupSpam returns value of CanReportSupergroupSpam field.
func (m *MessageProperties) GetCanReportSupergroupSpam() (value bool) {
	if m == nil {
		return
	}
	return m.CanReportSupergroupSpam
}

// GetCanSetFactCheck returns value of CanSetFactCheck field.
func (m *MessageProperties) GetCanSetFactCheck() (value bool) {
	if m == nil {
		return
	}
	return m.CanSetFactCheck
}

// GetNeedShowStatistics returns value of NeedShowStatistics field.
func (m *MessageProperties) GetNeedShowStatistics() (value bool) {
	if m == nil {
		return
	}
	return m.NeedShowStatistics
}
