// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

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

// MessageMediaEmpty represents TL type `messageMediaEmpty#3ded6320`.
// Empty constructor.
//
// See https://core.telegram.org/constructor/messageMediaEmpty for reference.
type MessageMediaEmpty struct {
}

// MessageMediaEmptyTypeID is TL type id of MessageMediaEmpty.
const MessageMediaEmptyTypeID = 0x3ded6320

// construct implements constructor of MessageMediaClass.
func ( MessageMediaEmpty) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaEmpty{}
)

func ( *MessageMediaEmpty) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaEmpty) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaEmpty",
		ID:   MessageMediaEmptyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaEmpty#3ded6320 as nil")
	}
	.PutID(MessageMediaEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaEmpty#3ded6320 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaEmpty#3ded6320 to nil")
	}
	if  := .ConsumeID(MessageMediaEmptyTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaEmpty#3ded6320: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaEmpty#3ded6320 to nil")
	}
	return nil
}

// MessageMediaPhoto represents TL type `messageMediaPhoto#695150d7`.
// Attached photo.
//
// See https://core.telegram.org/constructor/messageMediaPhoto for reference.
type MessageMediaPhoto struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this media should be hidden behind a spoiler warning
	Spoiler bool
	// Photo
	//
	// Use SetPhoto and GetPhoto helpers.
	Photo PhotoClass
	// Time to live in seconds of self-destructing photo
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
}

// MessageMediaPhotoTypeID is TL type id of MessageMediaPhoto.
const MessageMediaPhotoTypeID = 0x695150d7

// construct implements constructor of MessageMediaClass.
func ( MessageMediaPhoto) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaPhoto{}
)

func ( *MessageMediaPhoto) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.Photo == nil) {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaPhoto from given interface.
func ( *MessageMediaPhoto) ( interface {
	() ( bool)
	() ( PhotoClass,  bool)
	() ( int,  bool)
}) {
	.Spoiler = .()
	if ,  := .();  {
		.Photo = 
	}

	if ,  := .();  {
		.TTLSeconds = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaPhoto) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaPhoto",
		ID:   MessageMediaPhotoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaPhoto) () {
	if !(.Spoiler == false) {
		.Flags.Set(3)
	}
	if !(.Photo == nil) {
		.Flags.Set(0)
	}
	if !(.TTLSeconds == 0) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaPhoto#695150d7 as nil")
	}
	.PutID(MessageMediaPhotoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaPhoto#695150d7 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaPhoto#695150d7: field flags: %w", )
	}
	if .Flags.Has(0) {
		if .Photo == nil {
			return fmt.Errorf("unable to encode messageMediaPhoto#695150d7: field photo is nil")
		}
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode messageMediaPhoto#695150d7: field photo: %w", )
		}
	}
	if .Flags.Has(2) {
		.PutInt(.TTLSeconds)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaPhoto#695150d7 to nil")
	}
	if  := .ConsumeID(MessageMediaPhotoTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaPhoto#695150d7 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(3)
	if .Flags.Has(0) {
		,  := DecodePhoto()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: field photo: %w", )
		}
		.Photo = 
	}
	if .Flags.Has(2) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaPhoto#695150d7: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	return nil
}

// SetSpoiler sets value of Spoiler conditional field.
func ( *MessageMediaPhoto) ( bool) {
	if  {
		.Flags.Set(3)
		.Spoiler = true
	} else {
		.Flags.Unset(3)
		.Spoiler = false
	}
}

// GetSpoiler returns value of Spoiler conditional field.
func ( *MessageMediaPhoto) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetPhoto sets value of Photo conditional field.
func ( *MessageMediaPhoto) ( PhotoClass) {
	.Flags.Set(0)
	.Photo = 
}

// GetPhoto returns value of Photo conditional field and
// boolean which is true if field was set.
func ( *MessageMediaPhoto) () ( PhotoClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Photo, true
}

// SetTTLSeconds sets value of TTLSeconds conditional field.
func ( *MessageMediaPhoto) ( int) {
	.Flags.Set(2)
	.TTLSeconds = 
}

// GetTTLSeconds returns value of TTLSeconds conditional field and
// boolean which is true if field was set.
func ( *MessageMediaPhoto) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .TTLSeconds, true
}

// MessageMediaGeo represents TL type `messageMediaGeo#56e0d474`.
// Attached map.
//
// See https://core.telegram.org/constructor/messageMediaGeo for reference.
type MessageMediaGeo struct {
	// GeoPoint
	Geo GeoPointClass
}

// MessageMediaGeoTypeID is TL type id of MessageMediaGeo.
const MessageMediaGeoTypeID = 0x56e0d474

// construct implements constructor of MessageMediaClass.
func ( MessageMediaGeo) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaGeo{}
)

func ( *MessageMediaGeo) () bool {
	if  == nil {
		return true
	}
	if !(.Geo == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaGeo from given interface.
func ( *MessageMediaGeo) ( interface {
	() ( GeoPointClass)
}) {
	.Geo = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaGeo) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaGeo",
		ID:   MessageMediaGeoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Geo",
			SchemaName: "geo",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaGeo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGeo#56e0d474 as nil")
	}
	.PutID(MessageMediaGeoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaGeo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGeo#56e0d474 as nil")
	}
	if .Geo == nil {
		return fmt.Errorf("unable to encode messageMediaGeo#56e0d474: field geo is nil")
	}
	if  := .Geo.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaGeo#56e0d474: field geo: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaGeo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGeo#56e0d474 to nil")
	}
	if  := .ConsumeID(MessageMediaGeoTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaGeo#56e0d474: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaGeo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGeo#56e0d474 to nil")
	}
	{
		,  := DecodeGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGeo#56e0d474: field geo: %w", )
		}
		.Geo = 
	}
	return nil
}

// GetGeo returns value of Geo field.
func ( *MessageMediaGeo) () ( GeoPointClass) {
	if  == nil {
		return
	}
	return .Geo
}

// MessageMediaContact represents TL type `messageMediaContact#70322949`.
// Attached contact.
//
// See https://core.telegram.org/constructor/messageMediaContact for reference.
type MessageMediaContact struct {
	// Phone number
	PhoneNumber string
	// Contact's first name
	FirstName string
	// Contact's last name
	LastName string
	// VCARD of contact
	Vcard string
	// User identifier or 0, if the user with the given phone number is not registered
	UserID int64
}

// MessageMediaContactTypeID is TL type id of MessageMediaContact.
const MessageMediaContactTypeID = 0x70322949

// construct implements constructor of MessageMediaClass.
func ( MessageMediaContact) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaContact{}
)

func ( *MessageMediaContact) () bool {
	if  == nil {
		return true
	}
	if !(.PhoneNumber == "") {
		return false
	}
	if !(.FirstName == "") {
		return false
	}
	if !(.LastName == "") {
		return false
	}
	if !(.Vcard == "") {
		return false
	}
	if !(.UserID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaContact from given interface.
func ( *MessageMediaContact) ( interface {
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( int64)
}) {
	.PhoneNumber = .()
	.FirstName = .()
	.LastName = .()
	.Vcard = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaContact) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaContact",
		ID:   MessageMediaContactTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "FirstName",
			SchemaName: "first_name",
		},
		{
			Name:       "LastName",
			SchemaName: "last_name",
		},
		{
			Name:       "Vcard",
			SchemaName: "vcard",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaContact#70322949 as nil")
	}
	.PutID(MessageMediaContactTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaContact#70322949 as nil")
	}
	.PutString(.PhoneNumber)
	.PutString(.FirstName)
	.PutString(.LastName)
	.PutString(.Vcard)
	.PutLong(.UserID)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaContact#70322949 to nil")
	}
	if  := .ConsumeID(MessageMediaContactTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaContact#70322949: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaContact#70322949 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaContact#70322949: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaContact#70322949: field first_name: %w", )
		}
		.FirstName = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaContact#70322949: field last_name: %w", )
		}
		.LastName = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaContact#70322949: field vcard: %w", )
		}
		.Vcard = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaContact#70322949: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// GetPhoneNumber returns value of PhoneNumber field.
func ( *MessageMediaContact) () ( string) {
	if  == nil {
		return
	}
	return .PhoneNumber
}

// GetFirstName returns value of FirstName field.
func ( *MessageMediaContact) () ( string) {
	if  == nil {
		return
	}
	return .FirstName
}

// GetLastName returns value of LastName field.
func ( *MessageMediaContact) () ( string) {
	if  == nil {
		return
	}
	return .LastName
}

// GetVcard returns value of Vcard field.
func ( *MessageMediaContact) () ( string) {
	if  == nil {
		return
	}
	return .Vcard
}

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

// MessageMediaUnsupported represents TL type `messageMediaUnsupported#9f84f49e`.
// Current version of the client does not support this media type.
//
// See https://core.telegram.org/constructor/messageMediaUnsupported for reference.
type MessageMediaUnsupported struct {
}

// MessageMediaUnsupportedTypeID is TL type id of MessageMediaUnsupported.
const MessageMediaUnsupportedTypeID = 0x9f84f49e

// construct implements constructor of MessageMediaClass.
func ( MessageMediaUnsupported) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaUnsupported{}
)

func ( *MessageMediaUnsupported) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaUnsupported) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaUnsupported",
		ID:   MessageMediaUnsupportedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaUnsupported) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaUnsupported#9f84f49e as nil")
	}
	.PutID(MessageMediaUnsupportedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaUnsupported) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaUnsupported#9f84f49e as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaUnsupported) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaUnsupported#9f84f49e to nil")
	}
	if  := .ConsumeID(MessageMediaUnsupportedTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaUnsupported#9f84f49e: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaUnsupported) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaUnsupported#9f84f49e to nil")
	}
	return nil
}

// MessageMediaDocument represents TL type `messageMediaDocument#4cf4d72d`.
// Document (video, audio, voice, sticker, any media type except photo)
//
// See https://core.telegram.org/constructor/messageMediaDocument for reference.
type MessageMediaDocument struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this is a normal sticker, if not set this is a premium sticker and a premium
	// sticker animation must be played.
	Nopremium bool
	// Whether this media should be hidden behind a spoiler warning
	Spoiler bool
	// Attached document
	//
	// Use SetDocument and GetDocument helpers.
	Document DocumentClass
	// Currently only used for story videos, may contain an alternative version of the story
	// video, explicitly encoded using H.264 (in MPEG4 transport) at a lower resolution than
	// document.
	//
	// Use SetAltDocument and GetAltDocument helpers.
	AltDocument DocumentClass
	// Time to live of self-destructing document
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
}

// MessageMediaDocumentTypeID is TL type id of MessageMediaDocument.
const MessageMediaDocumentTypeID = 0x4cf4d72d

// construct implements constructor of MessageMediaClass.
func ( MessageMediaDocument) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaDocument{}
)

func ( *MessageMediaDocument) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Nopremium == false) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.Document == nil) {
		return false
	}
	if !(.AltDocument == nil) {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaDocument from given interface.
func ( *MessageMediaDocument) ( interface {
	() ( bool)
	() ( bool)
	() ( DocumentClass,  bool)
	() ( DocumentClass,  bool)
	() ( int,  bool)
}) {
	.Nopremium = .()
	.Spoiler = .()
	if ,  := .();  {
		.Document = 
	}

	if ,  := .();  {
		.AltDocument = 
	}

	if ,  := .();  {
		.TTLSeconds = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaDocument) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaDocument",
		ID:   MessageMediaDocumentTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Nopremium",
			SchemaName: "nopremium",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Document",
			SchemaName: "document",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "AltDocument",
			SchemaName: "alt_document",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaDocument) () {
	if !(.Nopremium == false) {
		.Flags.Set(3)
	}
	if !(.Spoiler == false) {
		.Flags.Set(4)
	}
	if !(.Document == nil) {
		.Flags.Set(0)
	}
	if !(.AltDocument == nil) {
		.Flags.Set(5)
	}
	if !(.TTLSeconds == 0) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaDocument#4cf4d72d as nil")
	}
	.PutID(MessageMediaDocumentTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaDocument#4cf4d72d as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaDocument#4cf4d72d: field flags: %w", )
	}
	if .Flags.Has(0) {
		if .Document == nil {
			return fmt.Errorf("unable to encode messageMediaDocument#4cf4d72d: field document is nil")
		}
		if  := .Document.Encode();  != nil {
			return fmt.Errorf("unable to encode messageMediaDocument#4cf4d72d: field document: %w", )
		}
	}
	if .Flags.Has(5) {
		if .AltDocument == nil {
			return fmt.Errorf("unable to encode messageMediaDocument#4cf4d72d: field alt_document is nil")
		}
		if  := .AltDocument.Encode();  != nil {
			return fmt.Errorf("unable to encode messageMediaDocument#4cf4d72d: field alt_document: %w", )
		}
	}
	if .Flags.Has(2) {
		.PutInt(.TTLSeconds)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaDocument#4cf4d72d to nil")
	}
	if  := .ConsumeID(MessageMediaDocumentTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaDocument#4cf4d72d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaDocument#4cf4d72d to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaDocument#4cf4d72d: field flags: %w", )
		}
	}
	.Nopremium = .Flags.Has(3)
	.Spoiler = .Flags.Has(4)
	if .Flags.Has(0) {
		,  := DecodeDocument()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaDocument#4cf4d72d: field document: %w", )
		}
		.Document = 
	}
	if .Flags.Has(5) {
		,  := DecodeDocument()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaDocument#4cf4d72d: field alt_document: %w", )
		}
		.AltDocument = 
	}
	if .Flags.Has(2) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaDocument#4cf4d72d: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	return nil
}

// SetNopremium sets value of Nopremium conditional field.
func ( *MessageMediaDocument) ( bool) {
	if  {
		.Flags.Set(3)
		.Nopremium = true
	} else {
		.Flags.Unset(3)
		.Nopremium = false
	}
}

// GetNopremium returns value of Nopremium conditional field.
func ( *MessageMediaDocument) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetSpoiler sets value of Spoiler conditional field.
func ( *MessageMediaDocument) ( bool) {
	if  {
		.Flags.Set(4)
		.Spoiler = true
	} else {
		.Flags.Unset(4)
		.Spoiler = false
	}
}

// GetSpoiler returns value of Spoiler conditional field.
func ( *MessageMediaDocument) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

// SetDocument sets value of Document conditional field.
func ( *MessageMediaDocument) ( DocumentClass) {
	.Flags.Set(0)
	.Document = 
}

// GetDocument returns value of Document conditional field and
// boolean which is true if field was set.
func ( *MessageMediaDocument) () ( DocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Document, true
}

// SetAltDocument sets value of AltDocument conditional field.
func ( *MessageMediaDocument) ( DocumentClass) {
	.Flags.Set(5)
	.AltDocument = 
}

// GetAltDocument returns value of AltDocument conditional field and
// boolean which is true if field was set.
func ( *MessageMediaDocument) () ( DocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(5) {
		return , false
	}
	return .AltDocument, true
}

// SetTTLSeconds sets value of TTLSeconds conditional field.
func ( *MessageMediaDocument) ( int) {
	.Flags.Set(2)
	.TTLSeconds = 
}

// GetTTLSeconds returns value of TTLSeconds conditional field and
// boolean which is true if field was set.
func ( *MessageMediaDocument) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .TTLSeconds, true
}

// MessageMediaWebPage represents TL type `messageMediaWebPage#ddf10c3b`.
// Preview of webpage
//
// See https://core.telegram.org/constructor/messageMediaWebPage for reference.
type MessageMediaWebPage struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, specifies that a large media preview should be used.
	ForceLargeMedia bool
	// If set, specifies that a small media preview should be used.
	ForceSmallMedia bool
	// If set, indicates that the URL used for the webpage preview was specified manually
	// using inputMediaWebPage¹, and may not be related to any of the URLs specified in the
	// message.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputMediaWebPage
	Manual bool
	// If set, the webpage can be opened directly without user confirmation; otherwise, user
	// confirmation is required, showing the exact URL that will be opened.
	Safe bool
	// Webpage preview
	Webpage WebPageClass
}

// MessageMediaWebPageTypeID is TL type id of MessageMediaWebPage.
const MessageMediaWebPageTypeID = 0xddf10c3b

// construct implements constructor of MessageMediaClass.
func ( MessageMediaWebPage) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaWebPage{}
)

func ( *MessageMediaWebPage) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ForceLargeMedia == false) {
		return false
	}
	if !(.ForceSmallMedia == false) {
		return false
	}
	if !(.Manual == false) {
		return false
	}
	if !(.Safe == false) {
		return false
	}
	if !(.Webpage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaWebPage from given interface.
func ( *MessageMediaWebPage) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( WebPageClass)
}) {
	.ForceLargeMedia = .()
	.ForceSmallMedia = .()
	.Manual = .()
	.Safe = .()
	.Webpage = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaWebPage) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaWebPage",
		ID:   MessageMediaWebPageTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ForceLargeMedia",
			SchemaName: "force_large_media",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "ForceSmallMedia",
			SchemaName: "force_small_media",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Manual",
			SchemaName: "manual",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Safe",
			SchemaName: "safe",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Webpage",
			SchemaName: "webpage",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaWebPage) () {
	if !(.ForceLargeMedia == false) {
		.Flags.Set(0)
	}
	if !(.ForceSmallMedia == false) {
		.Flags.Set(1)
	}
	if !(.Manual == false) {
		.Flags.Set(3)
	}
	if !(.Safe == false) {
		.Flags.Set(4)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaWebPage#ddf10c3b as nil")
	}
	.PutID(MessageMediaWebPageTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaWebPage#ddf10c3b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaWebPage#ddf10c3b: field flags: %w", )
	}
	if .Webpage == nil {
		return fmt.Errorf("unable to encode messageMediaWebPage#ddf10c3b: field webpage is nil")
	}
	if  := .Webpage.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaWebPage#ddf10c3b: field webpage: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaWebPage#ddf10c3b to nil")
	}
	if  := .ConsumeID(MessageMediaWebPageTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaWebPage#ddf10c3b: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaWebPage#ddf10c3b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaWebPage#ddf10c3b: field flags: %w", )
		}
	}
	.ForceLargeMedia = .Flags.Has(0)
	.ForceSmallMedia = .Flags.Has(1)
	.Manual = .Flags.Has(3)
	.Safe = .Flags.Has(4)
	{
		,  := DecodeWebPage()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaWebPage#ddf10c3b: field webpage: %w", )
		}
		.Webpage = 
	}
	return nil
}

// SetForceLargeMedia sets value of ForceLargeMedia conditional field.
func ( *MessageMediaWebPage) ( bool) {
	if  {
		.Flags.Set(0)
		.ForceLargeMedia = true
	} else {
		.Flags.Unset(0)
		.ForceLargeMedia = false
	}
}

// GetForceLargeMedia returns value of ForceLargeMedia conditional field.
func ( *MessageMediaWebPage) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetForceSmallMedia sets value of ForceSmallMedia conditional field.
func ( *MessageMediaWebPage) ( bool) {
	if  {
		.Flags.Set(1)
		.ForceSmallMedia = true
	} else {
		.Flags.Unset(1)
		.ForceSmallMedia = false
	}
}

// GetForceSmallMedia returns value of ForceSmallMedia conditional field.
func ( *MessageMediaWebPage) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetManual sets value of Manual conditional field.
func ( *MessageMediaWebPage) ( bool) {
	if  {
		.Flags.Set(3)
		.Manual = true
	} else {
		.Flags.Unset(3)
		.Manual = false
	}
}

// GetManual returns value of Manual conditional field.
func ( *MessageMediaWebPage) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetSafe sets value of Safe conditional field.
func ( *MessageMediaWebPage) ( bool) {
	if  {
		.Flags.Set(4)
		.Safe = true
	} else {
		.Flags.Unset(4)
		.Safe = false
	}
}

// GetSafe returns value of Safe conditional field.
func ( *MessageMediaWebPage) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

// GetWebpage returns value of Webpage field.
func ( *MessageMediaWebPage) () ( WebPageClass) {
	if  == nil {
		return
	}
	return .Webpage
}

// MessageMediaVenue represents TL type `messageMediaVenue#2ec0533f`.
// Venue
//
// See https://core.telegram.org/constructor/messageMediaVenue for reference.
type MessageMediaVenue struct {
	// Geolocation of venue
	Geo GeoPointClass
	// Venue name
	Title string
	// Address
	Address string
	// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be
	// supported
	Provider string
	// Venue ID in the provider's database
	VenueID string
	// Venue type in the provider's database
	VenueType string
}

// MessageMediaVenueTypeID is TL type id of MessageMediaVenue.
const MessageMediaVenueTypeID = 0x2ec0533f

// construct implements constructor of MessageMediaClass.
func ( MessageMediaVenue) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaVenue{}
)

func ( *MessageMediaVenue) () bool {
	if  == nil {
		return true
	}
	if !(.Geo == nil) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Address == "") {
		return false
	}
	if !(.Provider == "") {
		return false
	}
	if !(.VenueID == "") {
		return false
	}
	if !(.VenueType == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaVenue from given interface.
func ( *MessageMediaVenue) ( interface {
	() ( GeoPointClass)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
}) {
	.Geo = .()
	.Title = .()
	.Address = .()
	.Provider = .()
	.VenueID = .()
	.VenueType = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaVenue) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaVenue",
		ID:   MessageMediaVenueTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Geo",
			SchemaName: "geo",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Address",
			SchemaName: "address",
		},
		{
			Name:       "Provider",
			SchemaName: "provider",
		},
		{
			Name:       "VenueID",
			SchemaName: "venue_id",
		},
		{
			Name:       "VenueType",
			SchemaName: "venue_type",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaVenue#2ec0533f as nil")
	}
	.PutID(MessageMediaVenueTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaVenue#2ec0533f as nil")
	}
	if .Geo == nil {
		return fmt.Errorf("unable to encode messageMediaVenue#2ec0533f: field geo is nil")
	}
	if  := .Geo.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaVenue#2ec0533f: field geo: %w", )
	}
	.PutString(.Title)
	.PutString(.Address)
	.PutString(.Provider)
	.PutString(.VenueID)
	.PutString(.VenueType)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaVenue#2ec0533f to nil")
	}
	if  := .ConsumeID(MessageMediaVenueTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaVenue#2ec0533f to nil")
	}
	{
		,  := DecodeGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: field geo: %w", )
		}
		.Geo = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: field address: %w", )
		}
		.Address = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: field provider: %w", )
		}
		.Provider = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: field venue_id: %w", )
		}
		.VenueID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaVenue#2ec0533f: field venue_type: %w", )
		}
		.VenueType = 
	}
	return nil
}

// GetGeo returns value of Geo field.
func ( *MessageMediaVenue) () ( GeoPointClass) {
	if  == nil {
		return
	}
	return .Geo
}

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

// GetAddress returns value of Address field.
func ( *MessageMediaVenue) () ( string) {
	if  == nil {
		return
	}
	return .Address
}

// GetProvider returns value of Provider field.
func ( *MessageMediaVenue) () ( string) {
	if  == nil {
		return
	}
	return .Provider
}

// GetVenueID returns value of VenueID field.
func ( *MessageMediaVenue) () ( string) {
	if  == nil {
		return
	}
	return .VenueID
}

// GetVenueType returns value of VenueType field.
func ( *MessageMediaVenue) () ( string) {
	if  == nil {
		return
	}
	return .VenueType
}

// MessageMediaGame represents TL type `messageMediaGame#fdb19008`.
// Telegram game
//
// See https://core.telegram.org/constructor/messageMediaGame for reference.
type MessageMediaGame struct {
	// Game
	Game Game
}

// MessageMediaGameTypeID is TL type id of MessageMediaGame.
const MessageMediaGameTypeID = 0xfdb19008

// construct implements constructor of MessageMediaClass.
func ( MessageMediaGame) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaGame{}
)

func ( *MessageMediaGame) () bool {
	if  == nil {
		return true
	}
	if !(.Game.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaGame from given interface.
func ( *MessageMediaGame) ( interface {
	() ( Game)
}) {
	.Game = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaGame) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaGame",
		ID:   MessageMediaGameTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Game",
			SchemaName: "game",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGame#fdb19008 as nil")
	}
	.PutID(MessageMediaGameTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGame#fdb19008 as nil")
	}
	if  := .Game.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaGame#fdb19008: field game: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGame#fdb19008 to nil")
	}
	if  := .ConsumeID(MessageMediaGameTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaGame#fdb19008: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGame#fdb19008 to nil")
	}
	{
		if  := .Game.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaGame#fdb19008: field game: %w", )
		}
	}
	return nil
}

// GetGame returns value of Game field.
func ( *MessageMediaGame) () ( Game) {
	if  == nil {
		return
	}
	return .Game
}

// MessageMediaInvoice represents TL type `messageMediaInvoice#f6a548d3`.
// Invoice
//
// See https://core.telegram.org/constructor/messageMediaInvoice for reference.
type MessageMediaInvoice struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the shipping address was requested
	ShippingAddressRequested bool
	// Whether this is an example invoice
	Test bool
	// Product name, 1-32 characters
	Title string
	// Product description, 1-255 characters
	Description string
	// URL of the product photo for the invoice. Can be a photo of the goods or a marketing
	// image for a service. People like it better when they see what they are paying for.
	//
	// Use SetPhoto and GetPhoto helpers.
	Photo WebDocumentClass
	// Message ID of receipt: if set, clients should change the text of the first
	// keyboardButtonBuy¹ button always attached to the message² to a localized version of
	// the word Receipt
	//
	// Links:
	//  1) https://core.telegram.org/constructor/keyboardButtonBuy
	//  2) https://core.telegram.org/constructor/message
	//
	// Use SetReceiptMsgID and GetReceiptMsgID helpers.
	ReceiptMsgID int
	// Three-letter ISO 4217 currency¹ code
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments#supported-currencies
	Currency string
	// Total price 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
	// Unique bot deep-linking parameter that can be used to generate this invoice
	StartParam string
	// Extended media
	//
	// Use SetExtendedMedia and GetExtendedMedia helpers.
	ExtendedMedia MessageExtendedMediaClass
}

// MessageMediaInvoiceTypeID is TL type id of MessageMediaInvoice.
const MessageMediaInvoiceTypeID = 0xf6a548d3

// construct implements constructor of MessageMediaClass.
func ( MessageMediaInvoice) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaInvoice{}
)

func ( *MessageMediaInvoice) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ShippingAddressRequested == false) {
		return false
	}
	if !(.Test == false) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Description == "") {
		return false
	}
	if !(.Photo == nil) {
		return false
	}
	if !(.ReceiptMsgID == 0) {
		return false
	}
	if !(.Currency == "") {
		return false
	}
	if !(.TotalAmount == 0) {
		return false
	}
	if !(.StartParam == "") {
		return false
	}
	if !(.ExtendedMedia == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaInvoice from given interface.
func ( *MessageMediaInvoice) ( interface {
	() ( bool)
	() ( bool)
	() ( string)
	() ( string)
	() ( WebDocumentClass,  bool)
	() ( int,  bool)
	() ( string)
	() ( int64)
	() ( string)
	() ( MessageExtendedMediaClass,  bool)
}) {
	.ShippingAddressRequested = .()
	.Test = .()
	.Title = .()
	.Description = .()
	if ,  := .();  {
		.Photo = 
	}

	if ,  := .();  {
		.ReceiptMsgID = 
	}

	.Currency = .()
	.TotalAmount = .()
	.StartParam = .()
	if ,  := .();  {
		.ExtendedMedia = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaInvoice) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaInvoice",
		ID:   MessageMediaInvoiceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ShippingAddressRequested",
			SchemaName: "shipping_address_requested",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Test",
			SchemaName: "test",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Description",
			SchemaName: "description",
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "ReceiptMsgID",
			SchemaName: "receipt_msg_id",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Currency",
			SchemaName: "currency",
		},
		{
			Name:       "TotalAmount",
			SchemaName: "total_amount",
		},
		{
			Name:       "StartParam",
			SchemaName: "start_param",
		},
		{
			Name:       "ExtendedMedia",
			SchemaName: "extended_media",
			Null:       !.Flags.Has(4),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaInvoice) () {
	if !(.ShippingAddressRequested == false) {
		.Flags.Set(1)
	}
	if !(.Test == false) {
		.Flags.Set(3)
	}
	if !(.Photo == nil) {
		.Flags.Set(0)
	}
	if !(.ReceiptMsgID == 0) {
		.Flags.Set(2)
	}
	if !(.ExtendedMedia == nil) {
		.Flags.Set(4)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaInvoice#f6a548d3 as nil")
	}
	.PutID(MessageMediaInvoiceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaInvoice#f6a548d3 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaInvoice#f6a548d3: field flags: %w", )
	}
	.PutString(.Title)
	.PutString(.Description)
	if .Flags.Has(0) {
		if .Photo == nil {
			return fmt.Errorf("unable to encode messageMediaInvoice#f6a548d3: field photo is nil")
		}
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode messageMediaInvoice#f6a548d3: field photo: %w", )
		}
	}
	if .Flags.Has(2) {
		.PutInt(.ReceiptMsgID)
	}
	.PutString(.Currency)
	.PutLong(.TotalAmount)
	.PutString(.StartParam)
	if .Flags.Has(4) {
		if .ExtendedMedia == nil {
			return fmt.Errorf("unable to encode messageMediaInvoice#f6a548d3: field extended_media is nil")
		}
		if  := .ExtendedMedia.Encode();  != nil {
			return fmt.Errorf("unable to encode messageMediaInvoice#f6a548d3: field extended_media: %w", )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaInvoice#f6a548d3 to nil")
	}
	if  := .ConsumeID(MessageMediaInvoiceTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaInvoice#f6a548d3 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field flags: %w", )
		}
	}
	.ShippingAddressRequested = .Flags.Has(1)
	.Test = .Flags.Has(3)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field description: %w", )
		}
		.Description = 
	}
	if .Flags.Has(0) {
		,  := DecodeWebDocument()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field photo: %w", )
		}
		.Photo = 
	}
	if .Flags.Has(2) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field receipt_msg_id: %w", )
		}
		.ReceiptMsgID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field currency: %w", )
		}
		.Currency = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field total_amount: %w", )
		}
		.TotalAmount = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field start_param: %w", )
		}
		.StartParam = 
	}
	if .Flags.Has(4) {
		,  := DecodeMessageExtendedMedia()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaInvoice#f6a548d3: field extended_media: %w", )
		}
		.ExtendedMedia = 
	}
	return nil
}

// SetShippingAddressRequested sets value of ShippingAddressRequested conditional field.
func ( *MessageMediaInvoice) ( bool) {
	if  {
		.Flags.Set(1)
		.ShippingAddressRequested = true
	} else {
		.Flags.Unset(1)
		.ShippingAddressRequested = false
	}
}

// GetShippingAddressRequested returns value of ShippingAddressRequested conditional field.
func ( *MessageMediaInvoice) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetTest sets value of Test conditional field.
func ( *MessageMediaInvoice) ( bool) {
	if  {
		.Flags.Set(3)
		.Test = true
	} else {
		.Flags.Unset(3)
		.Test = false
	}
}

// GetTest returns value of Test conditional field.
func ( *MessageMediaInvoice) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

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

// GetDescription returns value of Description field.
func ( *MessageMediaInvoice) () ( string) {
	if  == nil {
		return
	}
	return .Description
}

// SetPhoto sets value of Photo conditional field.
func ( *MessageMediaInvoice) ( WebDocumentClass) {
	.Flags.Set(0)
	.Photo = 
}

// GetPhoto returns value of Photo conditional field and
// boolean which is true if field was set.
func ( *MessageMediaInvoice) () ( WebDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Photo, true
}

// SetReceiptMsgID sets value of ReceiptMsgID conditional field.
func ( *MessageMediaInvoice) ( int) {
	.Flags.Set(2)
	.ReceiptMsgID = 
}

// GetReceiptMsgID returns value of ReceiptMsgID conditional field and
// boolean which is true if field was set.
func ( *MessageMediaInvoice) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReceiptMsgID, true
}

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

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

// GetStartParam returns value of StartParam field.
func ( *MessageMediaInvoice) () ( string) {
	if  == nil {
		return
	}
	return .StartParam
}

// SetExtendedMedia sets value of ExtendedMedia conditional field.
func ( *MessageMediaInvoice) ( MessageExtendedMediaClass) {
	.Flags.Set(4)
	.ExtendedMedia = 
}

// GetExtendedMedia returns value of ExtendedMedia conditional field and
// boolean which is true if field was set.
func ( *MessageMediaInvoice) () ( MessageExtendedMediaClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .ExtendedMedia, true
}

// MessageMediaGeoLive represents TL type `messageMediaGeoLive#b940c666`.
// Indicates a live geolocation¹
//
// Links:
//  1. https://core.telegram.org/api/live-location
//
// See https://core.telegram.org/constructor/messageMediaGeoLive for reference.
type MessageMediaGeoLive struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Geolocation
	Geo GeoPointClass
	// For live locations¹, a direction in which the location moves, in degrees; 1-360
	//
	// Links:
	//  1) https://core.telegram.org/api/live-location
	//
	// Use SetHeading and GetHeading helpers.
	Heading int
	// Validity period of provided geolocation
	Period int
	// For live locations¹, a maximum distance to another chat member for proximity alerts,
	// in meters (0-100000).
	//
	// Links:
	//  1) https://core.telegram.org/api/live-location
	//
	// Use SetProximityNotificationRadius and GetProximityNotificationRadius helpers.
	ProximityNotificationRadius int
}

// MessageMediaGeoLiveTypeID is TL type id of MessageMediaGeoLive.
const MessageMediaGeoLiveTypeID = 0xb940c666

// construct implements constructor of MessageMediaClass.
func ( MessageMediaGeoLive) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaGeoLive{}
)

func ( *MessageMediaGeoLive) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Geo == nil) {
		return false
	}
	if !(.Heading == 0) {
		return false
	}
	if !(.Period == 0) {
		return false
	}
	if !(.ProximityNotificationRadius == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaGeoLive from given interface.
func ( *MessageMediaGeoLive) ( interface {
	() ( GeoPointClass)
	() ( int,  bool)
	() ( int)
	() ( int,  bool)
}) {
	.Geo = .()
	if ,  := .();  {
		.Heading = 
	}

	.Period = .()
	if ,  := .();  {
		.ProximityNotificationRadius = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaGeoLive) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaGeoLive",
		ID:   MessageMediaGeoLiveTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Geo",
			SchemaName: "geo",
		},
		{
			Name:       "Heading",
			SchemaName: "heading",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Period",
			SchemaName: "period",
		},
		{
			Name:       "ProximityNotificationRadius",
			SchemaName: "proximity_notification_radius",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaGeoLive) () {
	if !(.Heading == 0) {
		.Flags.Set(0)
	}
	if !(.ProximityNotificationRadius == 0) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGeoLive#b940c666 as nil")
	}
	.PutID(MessageMediaGeoLiveTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGeoLive#b940c666 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaGeoLive#b940c666: field flags: %w", )
	}
	if .Geo == nil {
		return fmt.Errorf("unable to encode messageMediaGeoLive#b940c666: field geo is nil")
	}
	if  := .Geo.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaGeoLive#b940c666: field geo: %w", )
	}
	if .Flags.Has(0) {
		.PutInt(.Heading)
	}
	.PutInt(.Period)
	if .Flags.Has(1) {
		.PutInt(.ProximityNotificationRadius)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGeoLive#b940c666 to nil")
	}
	if  := .ConsumeID(MessageMediaGeoLiveTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaGeoLive#b940c666: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGeoLive#b940c666 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaGeoLive#b940c666: field flags: %w", )
		}
	}
	{
		,  := DecodeGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGeoLive#b940c666: field geo: %w", )
		}
		.Geo = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGeoLive#b940c666: field heading: %w", )
		}
		.Heading = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGeoLive#b940c666: field period: %w", )
		}
		.Period = 
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGeoLive#b940c666: field proximity_notification_radius: %w", )
		}
		.ProximityNotificationRadius = 
	}
	return nil
}

// GetGeo returns value of Geo field.
func ( *MessageMediaGeoLive) () ( GeoPointClass) {
	if  == nil {
		return
	}
	return .Geo
}

// SetHeading sets value of Heading conditional field.
func ( *MessageMediaGeoLive) ( int) {
	.Flags.Set(0)
	.Heading = 
}

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

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

// SetProximityNotificationRadius sets value of ProximityNotificationRadius conditional field.
func ( *MessageMediaGeoLive) ( int) {
	.Flags.Set(1)
	.ProximityNotificationRadius = 
}

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

// MessageMediaPoll represents TL type `messageMediaPoll#4bd6e798`.
// Poll
//
// See https://core.telegram.org/constructor/messageMediaPoll for reference.
type MessageMediaPoll struct {
	// The poll
	Poll Poll
	// The results of the poll
	Results PollResults
}

// MessageMediaPollTypeID is TL type id of MessageMediaPoll.
const MessageMediaPollTypeID = 0x4bd6e798

// construct implements constructor of MessageMediaClass.
func ( MessageMediaPoll) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaPoll{}
)

func ( *MessageMediaPoll) () bool {
	if  == nil {
		return true
	}
	if !(.Poll.Zero()) {
		return false
	}
	if !(.Results.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaPoll from given interface.
func ( *MessageMediaPoll) ( interface {
	() ( Poll)
	() ( PollResults)
}) {
	.Poll = .()
	.Results = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaPoll) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaPoll",
		ID:   MessageMediaPollTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Poll",
			SchemaName: "poll",
		},
		{
			Name:       "Results",
			SchemaName: "results",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaPoll#4bd6e798 as nil")
	}
	.PutID(MessageMediaPollTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaPoll#4bd6e798 as nil")
	}
	if  := .Poll.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaPoll#4bd6e798: field poll: %w", )
	}
	if  := .Results.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaPoll#4bd6e798: field results: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaPoll#4bd6e798 to nil")
	}
	if  := .ConsumeID(MessageMediaPollTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaPoll#4bd6e798: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaPoll#4bd6e798 to nil")
	}
	{
		if  := .Poll.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaPoll#4bd6e798: field poll: %w", )
		}
	}
	{
		if  := .Results.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaPoll#4bd6e798: field results: %w", )
		}
	}
	return nil
}

// GetPoll returns value of Poll field.
func ( *MessageMediaPoll) () ( Poll) {
	if  == nil {
		return
	}
	return .Poll
}

// GetResults returns value of Results field.
func ( *MessageMediaPoll) () ( PollResults) {
	if  == nil {
		return
	}
	return .Results
}

// MessageMediaDice represents TL type `messageMediaDice#3f7ee58b`.
// Dice-based animated sticker¹
//
// Links:
//  1. https://core.telegram.org/api/dice
//
// See https://core.telegram.org/constructor/messageMediaDice for reference.
type MessageMediaDice struct {
	// Dice value¹
	//
	// Links:
	//  1) https://core.telegram.org/api/dice
	Value int
	// The emoji, for now ,  and  are supported
	Emoticon string
}

// MessageMediaDiceTypeID is TL type id of MessageMediaDice.
const MessageMediaDiceTypeID = 0x3f7ee58b

// construct implements constructor of MessageMediaClass.
func ( MessageMediaDice) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaDice{}
)

func ( *MessageMediaDice) () bool {
	if  == nil {
		return true
	}
	if !(.Value == 0) {
		return false
	}
	if !(.Emoticon == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaDice from given interface.
func ( *MessageMediaDice) ( interface {
	() ( int)
	() ( string)
}) {
	.Value = .()
	.Emoticon = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaDice) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaDice",
		ID:   MessageMediaDiceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Value",
			SchemaName: "value",
		},
		{
			Name:       "Emoticon",
			SchemaName: "emoticon",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaDice#3f7ee58b as nil")
	}
	.PutID(MessageMediaDiceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaDice#3f7ee58b as nil")
	}
	.PutInt(.Value)
	.PutString(.Emoticon)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaDice#3f7ee58b to nil")
	}
	if  := .ConsumeID(MessageMediaDiceTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaDice#3f7ee58b to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: field value: %w", )
		}
		.Value = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaDice#3f7ee58b: field emoticon: %w", )
		}
		.Emoticon = 
	}
	return nil
}

// GetValue returns value of Value field.
func ( *MessageMediaDice) () ( int) {
	if  == nil {
		return
	}
	return .Value
}

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

// MessageMediaStory represents TL type `messageMediaStory#68cb6283`.
// Represents a forwarded story¹ or a story mention.
//
// Links:
//  1. https://core.telegram.org/api/stories
//
// See https://core.telegram.org/constructor/messageMediaStory for reference.
type MessageMediaStory struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, indicates that this someone has mentioned us in this story (i.e. by tagging us
	// in the description) or vice versa, we have mentioned the other peer (if the message is
	// outgoing).
	ViaMention bool
	// Peer that posted the story.
	Peer PeerClass
	// Story ID
	ID int
	// The story itself, if absent fetch it using stories.getStoriesByID¹ and the peer/id
	// parameters specified above.
	//
	// Links:
	//  1) https://core.telegram.org/method/stories.getStoriesByID
	//
	// Use SetStory and GetStory helpers.
	Story StoryItemClass
}

// MessageMediaStoryTypeID is TL type id of MessageMediaStory.
const MessageMediaStoryTypeID = 0x68cb6283

// construct implements constructor of MessageMediaClass.
func ( MessageMediaStory) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaStory{}
)

func ( *MessageMediaStory) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ViaMention == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == 0) {
		return false
	}
	if !(.Story == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaStory from given interface.
func ( *MessageMediaStory) ( interface {
	() ( bool)
	() ( PeerClass)
	() ( int)
	() ( StoryItemClass,  bool)
}) {
	.ViaMention = .()
	.Peer = .()
	.ID = .()
	if ,  := .();  {
		.Story = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaStory) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaStory",
		ID:   MessageMediaStoryTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ViaMention",
			SchemaName: "via_mention",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Story",
			SchemaName: "story",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaStory) () {
	if !(.ViaMention == false) {
		.Flags.Set(1)
	}
	if !(.Story == nil) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaStory#68cb6283 as nil")
	}
	.PutID(MessageMediaStoryTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaStory#68cb6283 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaStory#68cb6283: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messageMediaStory#68cb6283: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaStory#68cb6283: field peer: %w", )
	}
	.PutInt(.ID)
	if .Flags.Has(0) {
		if .Story == nil {
			return fmt.Errorf("unable to encode messageMediaStory#68cb6283: field story is nil")
		}
		if  := .Story.Encode();  != nil {
			return fmt.Errorf("unable to encode messageMediaStory#68cb6283: field story: %w", )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaStory#68cb6283 to nil")
	}
	if  := .ConsumeID(MessageMediaStoryTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaStory#68cb6283: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaStory#68cb6283 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaStory#68cb6283: field flags: %w", )
		}
	}
	.ViaMention = .Flags.Has(1)
	{
		,  := DecodePeer()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaStory#68cb6283: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaStory#68cb6283: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := DecodeStoryItem()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaStory#68cb6283: field story: %w", )
		}
		.Story = 
	}
	return nil
}

// SetViaMention sets value of ViaMention conditional field.
func ( *MessageMediaStory) ( bool) {
	if  {
		.Flags.Set(1)
		.ViaMention = true
	} else {
		.Flags.Unset(1)
		.ViaMention = false
	}
}

// GetViaMention returns value of ViaMention conditional field.
func ( *MessageMediaStory) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

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

// GetID returns value of ID field.
func ( *MessageMediaStory) () ( int) {
	if  == nil {
		return
	}
	return .ID
}

// SetStory sets value of Story conditional field.
func ( *MessageMediaStory) ( StoryItemClass) {
	.Flags.Set(0)
	.Story = 
}

// GetStory returns value of Story conditional field and
// boolean which is true if field was set.
func ( *MessageMediaStory) () ( StoryItemClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Story, true
}

// MessageMediaGiveaway represents TL type `messageMediaGiveaway#daad85b0`.
// Contains info about a giveaway, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/giveaways
//
// See https://core.telegram.org/constructor/messageMediaGiveaway for reference.
type MessageMediaGiveaway struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, only new subscribers starting from the giveaway creation date will be able to
	// participate to the giveaway.
	OnlyNewSubscribers bool
	// WinnersAreVisible field of MessageMediaGiveaway.
	WinnersAreVisible bool
	// The channels that the user must join to participate in the giveaway.
	Channels []int64
	// If set, only users residing in these countries can participate in the giveaway,
	// (specified as a list of two-letter ISO 3166-1 alpha-2 country codes); otherwise there
	// are no country-based limitations.
	//
	// Use SetCountriesISO2 and GetCountriesISO2 helpers.
	CountriesISO2 []string
	// PrizeDescription field of MessageMediaGiveaway.
	//
	// Use SetPrizeDescription and GetPrizeDescription helpers.
	PrizeDescription string
	// Number of Telegram Premium¹ subscriptions given away.
	//
	// Links:
	//  1) https://core.telegram.org/api/premium
	Quantity int
	// Duration in months of each Telegram Premium¹ subscription in the giveaway.
	//
	// Links:
	//  1) https://core.telegram.org/api/premium
	Months int
	// The end date of the giveaway.
	UntilDate int
}

// MessageMediaGiveawayTypeID is TL type id of MessageMediaGiveaway.
const MessageMediaGiveawayTypeID = 0xdaad85b0

// construct implements constructor of MessageMediaClass.
func ( MessageMediaGiveaway) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaGiveaway{}
)

func ( *MessageMediaGiveaway) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.OnlyNewSubscribers == false) {
		return false
	}
	if !(.WinnersAreVisible == false) {
		return false
	}
	if !(.Channels == nil) {
		return false
	}
	if !(.CountriesISO2 == nil) {
		return false
	}
	if !(.PrizeDescription == "") {
		return false
	}
	if !(.Quantity == 0) {
		return false
	}
	if !(.Months == 0) {
		return false
	}
	if !(.UntilDate == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaGiveaway from given interface.
func ( *MessageMediaGiveaway) ( interface {
	() ( bool)
	() ( bool)
	() ( []int64)
	() ( []string,  bool)
	() ( string,  bool)
	() ( int)
	() ( int)
	() ( int)
}) {
	.OnlyNewSubscribers = .()
	.WinnersAreVisible = .()
	.Channels = .()
	if ,  := .();  {
		.CountriesISO2 = 
	}

	if ,  := .();  {
		.PrizeDescription = 
	}

	.Quantity = .()
	.Months = .()
	.UntilDate = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaGiveaway) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaGiveaway",
		ID:   MessageMediaGiveawayTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "OnlyNewSubscribers",
			SchemaName: "only_new_subscribers",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "WinnersAreVisible",
			SchemaName: "winners_are_visible",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Channels",
			SchemaName: "channels",
		},
		{
			Name:       "CountriesISO2",
			SchemaName: "countries_iso2",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "PrizeDescription",
			SchemaName: "prize_description",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Quantity",
			SchemaName: "quantity",
		},
		{
			Name:       "Months",
			SchemaName: "months",
		},
		{
			Name:       "UntilDate",
			SchemaName: "until_date",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaGiveaway) () {
	if !(.OnlyNewSubscribers == false) {
		.Flags.Set(0)
	}
	if !(.WinnersAreVisible == false) {
		.Flags.Set(2)
	}
	if !(.CountriesISO2 == nil) {
		.Flags.Set(1)
	}
	if !(.PrizeDescription == "") {
		.Flags.Set(3)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaGiveaway) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGiveaway#daad85b0 as nil")
	}
	.PutID(MessageMediaGiveawayTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaGiveaway) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGiveaway#daad85b0 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaGiveaway#daad85b0: field flags: %w", )
	}
	.PutVectorHeader(len(.Channels))
	for ,  := range .Channels {
		.PutLong()
	}
	if .Flags.Has(1) {
		.PutVectorHeader(len(.CountriesISO2))
		for ,  := range .CountriesISO2 {
			.PutString()
		}
	}
	if .Flags.Has(3) {
		.PutString(.PrizeDescription)
	}
	.PutInt(.Quantity)
	.PutInt(.Months)
	.PutInt(.UntilDate)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaGiveaway) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGiveaway#daad85b0 to nil")
	}
	if  := .ConsumeID(MessageMediaGiveawayTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaGiveaway) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGiveaway#daad85b0 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field flags: %w", )
		}
	}
	.OnlyNewSubscribers = .Flags.Has(0)
	.WinnersAreVisible = .Flags.Has(2)
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field channels: %w", )
		}

		if  > 0 {
			.Channels = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field channels: %w", )
			}
			.Channels = append(.Channels, )
		}
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w", )
		}

		if  > 0 {
			.CountriesISO2 = make([]string, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .String()
			if  != nil {
				return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w", )
			}
			.CountriesISO2 = append(.CountriesISO2, )
		}
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field prize_description: %w", )
		}
		.PrizeDescription = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field quantity: %w", )
		}
		.Quantity = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field months: %w", )
		}
		.Months = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveaway#daad85b0: field until_date: %w", )
		}
		.UntilDate = 
	}
	return nil
}

// SetOnlyNewSubscribers sets value of OnlyNewSubscribers conditional field.
func ( *MessageMediaGiveaway) ( bool) {
	if  {
		.Flags.Set(0)
		.OnlyNewSubscribers = true
	} else {
		.Flags.Unset(0)
		.OnlyNewSubscribers = false
	}
}

// GetOnlyNewSubscribers returns value of OnlyNewSubscribers conditional field.
func ( *MessageMediaGiveaway) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetWinnersAreVisible sets value of WinnersAreVisible conditional field.
func ( *MessageMediaGiveaway) ( bool) {
	if  {
		.Flags.Set(2)
		.WinnersAreVisible = true
	} else {
		.Flags.Unset(2)
		.WinnersAreVisible = false
	}
}

// GetWinnersAreVisible returns value of WinnersAreVisible conditional field.
func ( *MessageMediaGiveaway) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// GetChannels returns value of Channels field.
func ( *MessageMediaGiveaway) () ( []int64) {
	if  == nil {
		return
	}
	return .Channels
}

// SetCountriesISO2 sets value of CountriesISO2 conditional field.
func ( *MessageMediaGiveaway) ( []string) {
	.Flags.Set(1)
	.CountriesISO2 = 
}

// GetCountriesISO2 returns value of CountriesISO2 conditional field and
// boolean which is true if field was set.
func ( *MessageMediaGiveaway) () ( []string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .CountriesISO2, true
}

// SetPrizeDescription sets value of PrizeDescription conditional field.
func ( *MessageMediaGiveaway) ( string) {
	.Flags.Set(3)
	.PrizeDescription = 
}

// GetPrizeDescription returns value of PrizeDescription conditional field and
// boolean which is true if field was set.
func ( *MessageMediaGiveaway) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .PrizeDescription, true
}

// GetQuantity returns value of Quantity field.
func ( *MessageMediaGiveaway) () ( int) {
	if  == nil {
		return
	}
	return .Quantity
}

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

// GetUntilDate returns value of UntilDate field.
func ( *MessageMediaGiveaway) () ( int) {
	if  == nil {
		return
	}
	return .UntilDate
}

// MessageMediaGiveawayResults represents TL type `messageMediaGiveawayResults#c6991068`.
//
// See https://core.telegram.org/constructor/messageMediaGiveawayResults for reference.
type MessageMediaGiveawayResults struct {
	// Flags field of MessageMediaGiveawayResults.
	Flags bin.Fields
	// OnlyNewSubscribers field of MessageMediaGiveawayResults.
	OnlyNewSubscribers bool
	// Refunded field of MessageMediaGiveawayResults.
	Refunded bool
	// ChannelID field of MessageMediaGiveawayResults.
	ChannelID int64
	// AdditionalPeersCount field of MessageMediaGiveawayResults.
	//
	// Use SetAdditionalPeersCount and GetAdditionalPeersCount helpers.
	AdditionalPeersCount int
	// LaunchMsgID field of MessageMediaGiveawayResults.
	LaunchMsgID int
	// WinnersCount field of MessageMediaGiveawayResults.
	WinnersCount int
	// UnclaimedCount field of MessageMediaGiveawayResults.
	UnclaimedCount int
	// Winners field of MessageMediaGiveawayResults.
	Winners []int64
	// Months field of MessageMediaGiveawayResults.
	Months int
	// PrizeDescription field of MessageMediaGiveawayResults.
	//
	// Use SetPrizeDescription and GetPrizeDescription helpers.
	PrizeDescription string
	// UntilDate field of MessageMediaGiveawayResults.
	UntilDate int
}

// MessageMediaGiveawayResultsTypeID is TL type id of MessageMediaGiveawayResults.
const MessageMediaGiveawayResultsTypeID = 0xc6991068

// construct implements constructor of MessageMediaClass.
func ( MessageMediaGiveawayResults) () MessageMediaClass { return & }

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

	_ MessageMediaClass = &MessageMediaGiveawayResults{}
)

func ( *MessageMediaGiveawayResults) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.OnlyNewSubscribers == false) {
		return false
	}
	if !(.Refunded == false) {
		return false
	}
	if !(.ChannelID == 0) {
		return false
	}
	if !(.AdditionalPeersCount == 0) {
		return false
	}
	if !(.LaunchMsgID == 0) {
		return false
	}
	if !(.WinnersCount == 0) {
		return false
	}
	if !(.UnclaimedCount == 0) {
		return false
	}
	if !(.Winners == nil) {
		return false
	}
	if !(.Months == 0) {
		return false
	}
	if !(.PrizeDescription == "") {
		return false
	}
	if !(.UntilDate == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageMediaGiveawayResults from given interface.
func ( *MessageMediaGiveawayResults) ( interface {
	() ( bool)
	() ( bool)
	() ( int64)
	() ( int,  bool)
	() ( int)
	() ( int)
	() ( int)
	() ( []int64)
	() ( int)
	() ( string,  bool)
	() ( int)
}) {
	.OnlyNewSubscribers = .()
	.Refunded = .()
	.ChannelID = .()
	if ,  := .();  {
		.AdditionalPeersCount = 
	}

	.LaunchMsgID = .()
	.WinnersCount = .()
	.UnclaimedCount = .()
	.Winners = .()
	.Months = .()
	if ,  := .();  {
		.PrizeDescription = 
	}

	.UntilDate = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageMediaGiveawayResults) () tdp.Type {
	 := tdp.Type{
		Name: "messageMediaGiveawayResults",
		ID:   MessageMediaGiveawayResultsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "OnlyNewSubscribers",
			SchemaName: "only_new_subscribers",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Refunded",
			SchemaName: "refunded",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "ChannelID",
			SchemaName: "channel_id",
		},
		{
			Name:       "AdditionalPeersCount",
			SchemaName: "additional_peers_count",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "LaunchMsgID",
			SchemaName: "launch_msg_id",
		},
		{
			Name:       "WinnersCount",
			SchemaName: "winners_count",
		},
		{
			Name:       "UnclaimedCount",
			SchemaName: "unclaimed_count",
		},
		{
			Name:       "Winners",
			SchemaName: "winners",
		},
		{
			Name:       "Months",
			SchemaName: "months",
		},
		{
			Name:       "PrizeDescription",
			SchemaName: "prize_description",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "UntilDate",
			SchemaName: "until_date",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessageMediaGiveawayResults) () {
	if !(.OnlyNewSubscribers == false) {
		.Flags.Set(0)
	}
	if !(.Refunded == false) {
		.Flags.Set(2)
	}
	if !(.AdditionalPeersCount == 0) {
		.Flags.Set(3)
	}
	if !(.PrizeDescription == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *MessageMediaGiveawayResults) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGiveawayResults#c6991068 as nil")
	}
	.PutID(MessageMediaGiveawayResultsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageMediaGiveawayResults) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageMediaGiveawayResults#c6991068 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messageMediaGiveawayResults#c6991068: field flags: %w", )
	}
	.PutLong(.ChannelID)
	if .Flags.Has(3) {
		.PutInt(.AdditionalPeersCount)
	}
	.PutInt(.LaunchMsgID)
	.PutInt(.WinnersCount)
	.PutInt(.UnclaimedCount)
	.PutVectorHeader(len(.Winners))
	for ,  := range .Winners {
		.PutLong()
	}
	.PutInt(.Months)
	if .Flags.Has(1) {
		.PutString(.PrizeDescription)
	}
	.PutInt(.UntilDate)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessageMediaGiveawayResults) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGiveawayResults#c6991068 to nil")
	}
	if  := .ConsumeID(MessageMediaGiveawayResultsTypeID);  != nil {
		return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessageMediaGiveawayResults) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageMediaGiveawayResults#c6991068 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field flags: %w", )
		}
	}
	.OnlyNewSubscribers = .Flags.Has(0)
	.Refunded = .Flags.Has(2)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field channel_id: %w", )
		}
		.ChannelID = 
	}
	if .Flags.Has(3) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field additional_peers_count: %w", )
		}
		.AdditionalPeersCount = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field launch_msg_id: %w", )
		}
		.LaunchMsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners_count: %w", )
		}
		.WinnersCount = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field unclaimed_count: %w", )
		}
		.UnclaimedCount = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w", )
		}

		if  > 0 {
			.Winners = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w", )
			}
			.Winners = append(.Winners, )
		}
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field months: %w", )
		}
		.Months = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field prize_description: %w", )
		}
		.PrizeDescription = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageMediaGiveawayResults#c6991068: field until_date: %w", )
		}
		.UntilDate = 
	}
	return nil
}

// SetOnlyNewSubscribers sets value of OnlyNewSubscribers conditional field.
func ( *MessageMediaGiveawayResults) ( bool) {
	if  {
		.Flags.Set(0)
		.OnlyNewSubscribers = true
	} else {
		.Flags.Unset(0)
		.OnlyNewSubscribers = false
	}
}

// GetOnlyNewSubscribers returns value of OnlyNewSubscribers conditional field.
func ( *MessageMediaGiveawayResults) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetRefunded sets value of Refunded conditional field.
func ( *MessageMediaGiveawayResults) ( bool) {
	if  {
		.Flags.Set(2)
		.Refunded = true
	} else {
		.Flags.Unset(2)
		.Refunded = false
	}
}

// GetRefunded returns value of Refunded conditional field.
func ( *MessageMediaGiveawayResults) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

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

// SetAdditionalPeersCount sets value of AdditionalPeersCount conditional field.
func ( *MessageMediaGiveawayResults) ( int) {
	.Flags.Set(3)
	.AdditionalPeersCount = 
}

// GetAdditionalPeersCount returns value of AdditionalPeersCount conditional field and
// boolean which is true if field was set.
func ( *MessageMediaGiveawayResults) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .AdditionalPeersCount, true
}

// GetLaunchMsgID returns value of LaunchMsgID field.
func ( *MessageMediaGiveawayResults) () ( int) {
	if  == nil {
		return
	}
	return .LaunchMsgID
}

// GetWinnersCount returns value of WinnersCount field.
func ( *MessageMediaGiveawayResults) () ( int) {
	if  == nil {
		return
	}
	return .WinnersCount
}

// GetUnclaimedCount returns value of UnclaimedCount field.
func ( *MessageMediaGiveawayResults) () ( int) {
	if  == nil {
		return
	}
	return .UnclaimedCount
}

// GetWinners returns value of Winners field.
func ( *MessageMediaGiveawayResults) () ( []int64) {
	if  == nil {
		return
	}
	return .Winners
}

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

// SetPrizeDescription sets value of PrizeDescription conditional field.
func ( *MessageMediaGiveawayResults) ( string) {
	.Flags.Set(1)
	.PrizeDescription = 
}

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

// GetUntilDate returns value of UntilDate field.
func ( *MessageMediaGiveawayResults) () ( int) {
	if  == nil {
		return
	}
	return .UntilDate
}

// MessageMediaClassName is schema name of MessageMediaClass.
const MessageMediaClassName = "MessageMedia"

// MessageMediaClass represents MessageMedia generic type.
//
// See https://core.telegram.org/type/MessageMedia for reference.
//
// Example:
//
//	g, err := tg.DecodeMessageMedia(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessageMediaEmpty: // messageMediaEmpty#3ded6320
//	case *tg.MessageMediaPhoto: // messageMediaPhoto#695150d7
//	case *tg.MessageMediaGeo: // messageMediaGeo#56e0d474
//	case *tg.MessageMediaContact: // messageMediaContact#70322949
//	case *tg.MessageMediaUnsupported: // messageMediaUnsupported#9f84f49e
//	case *tg.MessageMediaDocument: // messageMediaDocument#4cf4d72d
//	case *tg.MessageMediaWebPage: // messageMediaWebPage#ddf10c3b
//	case *tg.MessageMediaVenue: // messageMediaVenue#2ec0533f
//	case *tg.MessageMediaGame: // messageMediaGame#fdb19008
//	case *tg.MessageMediaInvoice: // messageMediaInvoice#f6a548d3
//	case *tg.MessageMediaGeoLive: // messageMediaGeoLive#b940c666
//	case *tg.MessageMediaPoll: // messageMediaPoll#4bd6e798
//	case *tg.MessageMediaDice: // messageMediaDice#3f7ee58b
//	case *tg.MessageMediaStory: // messageMediaStory#68cb6283
//	case *tg.MessageMediaGiveaway: // messageMediaGiveaway#daad85b0
//	case *tg.MessageMediaGiveawayResults: // messageMediaGiveawayResults#c6991068
//	default: panic(v)
//	}
type MessageMediaClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessageMediaClass

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

// DecodeMessageMedia implements binary de-serialization for MessageMediaClass.
func ( *bin.Buffer) (MessageMediaClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessageMediaEmptyTypeID:
		// Decoding messageMediaEmpty#3ded6320.
		 := MessageMediaEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaPhotoTypeID:
		// Decoding messageMediaPhoto#695150d7.
		 := MessageMediaPhoto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaGeoTypeID:
		// Decoding messageMediaGeo#56e0d474.
		 := MessageMediaGeo{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaContactTypeID:
		// Decoding messageMediaContact#70322949.
		 := MessageMediaContact{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaUnsupportedTypeID:
		// Decoding messageMediaUnsupported#9f84f49e.
		 := MessageMediaUnsupported{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaDocumentTypeID:
		// Decoding messageMediaDocument#4cf4d72d.
		 := MessageMediaDocument{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaWebPageTypeID:
		// Decoding messageMediaWebPage#ddf10c3b.
		 := MessageMediaWebPage{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaVenueTypeID:
		// Decoding messageMediaVenue#2ec0533f.
		 := MessageMediaVenue{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaGameTypeID:
		// Decoding messageMediaGame#fdb19008.
		 := MessageMediaGame{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaInvoiceTypeID:
		// Decoding messageMediaInvoice#f6a548d3.
		 := MessageMediaInvoice{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaGeoLiveTypeID:
		// Decoding messageMediaGeoLive#b940c666.
		 := MessageMediaGeoLive{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaPollTypeID:
		// Decoding messageMediaPoll#4bd6e798.
		 := MessageMediaPoll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaDiceTypeID:
		// Decoding messageMediaDice#3f7ee58b.
		 := MessageMediaDice{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaStoryTypeID:
		// Decoding messageMediaStory#68cb6283.
		 := MessageMediaStory{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaGiveawayTypeID:
		// Decoding messageMediaGiveaway#daad85b0.
		 := MessageMediaGiveaway{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	case MessageMediaGiveawayResultsTypeID:
		// Decoding messageMediaGiveawayResults#c6991068.
		 := MessageMediaGiveawayResults{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessageMediaClass: %w", bin.NewUnexpectedID())
	}
}

// MessageMedia boxes the MessageMediaClass providing a helper.
type MessageMediaBox struct {
	MessageMedia MessageMediaClass
}

// Decode implements bin.Decoder for MessageMediaBox.
func ( *MessageMediaBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode MessageMediaBox to nil")
	}
	,  := DecodeMessageMedia()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.MessageMedia = 
	return nil
}

// Encode implements bin.Encode for MessageMediaBox.
func ( *MessageMediaBox) ( *bin.Buffer) error {
	if  == nil || .MessageMedia == nil {
		return fmt.Errorf("unable to encode MessageMediaClass as nil")
	}
	return .MessageMedia.Encode()
}