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

// InputMediaEmpty represents TL type `inputMediaEmpty#9664f57f`.
// Empty media content of a message.
//
// See https://core.telegram.org/constructor/inputMediaEmpty for reference.
type InputMediaEmpty struct {
}

// InputMediaEmptyTypeID is TL type id of InputMediaEmpty.
const InputMediaEmptyTypeID = 0x9664f57f

// construct implements constructor of InputMediaClass.
func ( InputMediaEmpty) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaEmpty{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaEmpty#9664f57f as nil")
	}
	.PutID(InputMediaEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaEmpty#9664f57f as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaEmpty#9664f57f to nil")
	}
	return nil
}

// InputMediaUploadedPhoto represents TL type `inputMediaUploadedPhoto#7d8375da`.
// Photo
//
// See https://core.telegram.org/constructor/inputMediaUploadedPhoto for reference.
type InputMediaUploadedPhoto 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
	// LivePhoto field of InputMediaUploadedPhoto.
	LivePhoto bool
	// The uploaded file¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files
	File InputFileClass
	// Attached mask stickers
	//
	// Use SetStickers and GetStickers helpers.
	Stickers []InputDocumentClass
	// Time to live in seconds of self-destructing photo
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
	// Video field of InputMediaUploadedPhoto.
	//
	// Use SetVideo and GetVideo helpers.
	Video InputDocumentClass
}

// InputMediaUploadedPhotoTypeID is TL type id of InputMediaUploadedPhoto.
const InputMediaUploadedPhotoTypeID = 0x7d8375da

// construct implements constructor of InputMediaClass.
func ( InputMediaUploadedPhoto) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaUploadedPhoto{}
)

func ( *InputMediaUploadedPhoto) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.LivePhoto == false) {
		return false
	}
	if !(.File == nil) {
		return false
	}
	if !(.Stickers == nil) {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}
	if !(.Video == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaUploadedPhoto from given interface.
func ( *InputMediaUploadedPhoto) ( interface {
	() ( bool)
	() ( bool)
	() ( InputFileClass)
	() ( []InputDocumentClass,  bool)
	() ( int,  bool)
	() ( InputDocumentClass,  bool)
}) {
	.Spoiler = .()
	.LivePhoto = .()
	.File = .()
	if ,  := .();  {
		.Stickers = 
	}

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaUploadedPhoto) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaUploadedPhoto",
		ID:   InputMediaUploadedPhotoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "LivePhoto",
			SchemaName: "live_photo",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "File",
			SchemaName: "file",
		},
		{
			Name:       "Stickers",
			SchemaName: "stickers",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Video",
			SchemaName: "video",
			Null:       !.Flags.Has(3),
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *InputMediaUploadedPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaUploadedPhoto#7d8375da as nil")
	}
	.PutID(InputMediaUploadedPhotoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaUploadedPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaUploadedPhoto#7d8375da as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field flags: %w", )
	}
	if .File == nil {
		return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field file is nil")
	}
	if  := .File.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field file: %w", )
	}
	if .Flags.Has(0) {
		.PutVectorHeader(len(.Stickers))
		for ,  := range .Stickers {
			if  == nil {
				return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field stickers element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field stickers element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(1) {
		.PutInt(.TTLSeconds)
	}
	if .Flags.Has(3) {
		if .Video == nil {
			return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field video is nil")
		}
		if  := .Video.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaUploadedPhoto#7d8375da: field video: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaUploadedPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaUploadedPhoto#7d8375da to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(2)
	.LivePhoto = .Flags.Has(3)
	{
		,  := DecodeInputFile()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field file: %w", )
		}
		.File = 
	}
	if .Flags.Has(0) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field stickers: %w", )
		}

		if  > 0 {
			.Stickers = make([]InputDocumentClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputDocument()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field stickers: %w", )
			}
			.Stickers = append(.Stickers, )
		}
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	if .Flags.Has(3) {
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedPhoto#7d8375da: field video: %w", )
		}
		.Video = 
	}
	return nil
}

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

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

// SetLivePhoto sets value of LivePhoto conditional field.
func ( *InputMediaUploadedPhoto) ( bool) {
	if  {
		.Flags.Set(3)
		.LivePhoto = true
	} else {
		.Flags.Unset(3)
		.LivePhoto = false
	}
}

// GetLivePhoto returns value of LivePhoto conditional field.
func ( *InputMediaUploadedPhoto) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// GetFile returns value of File field.
func ( *InputMediaUploadedPhoto) () ( InputFileClass) {
	if  == nil {
		return
	}
	return .File
}

// SetStickers sets value of Stickers conditional field.
func ( *InputMediaUploadedPhoto) ( []InputDocumentClass) {
	.Flags.Set(0)
	.Stickers = 
}

// GetStickers returns value of Stickers conditional field and
// boolean which is true if field was set.
func ( *InputMediaUploadedPhoto) () ( []InputDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Stickers, true
}

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

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

// SetVideo sets value of Video conditional field.
func ( *InputMediaUploadedPhoto) ( InputDocumentClass) {
	.Flags.Set(3)
	.Video = 
}

// GetVideo returns value of Video conditional field and
// boolean which is true if field was set.
func ( *InputMediaUploadedPhoto) () ( InputDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .Video, true
}

// MapStickers returns field Stickers wrapped in InputDocumentClassArray helper.
func ( *InputMediaUploadedPhoto) () ( InputDocumentClassArray,  bool) {
	if !.Flags.Has(0) {
		return , false
	}
	return InputDocumentClassArray(.Stickers), true
}

// InputMediaPhoto represents TL type `inputMediaPhoto#e3af4434`.
// Forwarded photo
//
// See https://core.telegram.org/constructor/inputMediaPhoto for reference.
type InputMediaPhoto 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
	// LivePhoto field of InputMediaPhoto.
	LivePhoto bool
	// Photo to be forwarded
	ID InputPhotoClass
	// Time to live in seconds of self-destructing photo
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
	// Video field of InputMediaPhoto.
	//
	// Use SetVideo and GetVideo helpers.
	Video InputDocumentClass
}

// InputMediaPhotoTypeID is TL type id of InputMediaPhoto.
const InputMediaPhotoTypeID = 0xe3af4434

// construct implements constructor of InputMediaClass.
func ( InputMediaPhoto) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaPhoto{}
)

func ( *InputMediaPhoto) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.LivePhoto == false) {
		return false
	}
	if !(.ID == nil) {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}
	if !(.Video == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaPhoto from given interface.
func ( *InputMediaPhoto) ( interface {
	() ( bool)
	() ( bool)
	() ( InputPhotoClass)
	() ( int,  bool)
	() ( InputDocumentClass,  bool)
}) {
	.Spoiler = .()
	.LivePhoto = .()
	.ID = .()
	if ,  := .();  {
		.TTLSeconds = 
	}

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaPhoto) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaPhoto",
		ID:   InputMediaPhotoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "LivePhoto",
			SchemaName: "live_photo",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Video",
			SchemaName: "video",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaPhoto) () {
	if !(.Spoiler == false) {
		.Flags.Set(1)
	}
	if !(.LivePhoto == false) {
		.Flags.Set(2)
	}
	if !(.TTLSeconds == 0) {
		.Flags.Set(0)
	}
	if !(.Video == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPhoto#e3af4434 as nil")
	}
	.PutID(InputMediaPhotoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPhoto#e3af4434 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field flags: %w", )
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field id: %w", )
	}
	if .Flags.Has(0) {
		.PutInt(.TTLSeconds)
	}
	if .Flags.Has(2) {
		if .Video == nil {
			return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field video is nil")
		}
		if  := .Video.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaPhoto#e3af4434: field video: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaPhoto#e3af4434 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(1)
	.LivePhoto = .Flags.Has(2)
	{
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	if .Flags.Has(2) {
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#e3af4434: field video: %w", )
		}
		.Video = 
	}
	return nil
}

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

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

// SetLivePhoto sets value of LivePhoto conditional field.
func ( *InputMediaPhoto) ( bool) {
	if  {
		.Flags.Set(2)
		.LivePhoto = true
	} else {
		.Flags.Unset(2)
		.LivePhoto = false
	}
}

// GetLivePhoto returns value of LivePhoto conditional field.
func ( *InputMediaPhoto) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

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

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

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

// SetVideo sets value of Video conditional field.
func ( *InputMediaPhoto) ( InputDocumentClass) {
	.Flags.Set(2)
	.Video = 
}

// GetVideo returns value of Video conditional field and
// boolean which is true if field was set.
func ( *InputMediaPhoto) () ( InputDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Video, true
}

// InputMediaGeoPoint represents TL type `inputMediaGeoPoint#f9c44144`.
// Map.
//
// See https://core.telegram.org/constructor/inputMediaGeoPoint for reference.
type InputMediaGeoPoint struct {
	// GeoPoint
	GeoPoint InputGeoPointClass
}

// InputMediaGeoPointTypeID is TL type id of InputMediaGeoPoint.
const InputMediaGeoPointTypeID = 0xf9c44144

// construct implements constructor of InputMediaClass.
func ( InputMediaGeoPoint) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaGeoPoint{}
)

func ( *InputMediaGeoPoint) () bool {
	if  == nil {
		return true
	}
	if !(.GeoPoint == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaGeoPoint from given interface.
func ( *InputMediaGeoPoint) ( interface {
	() ( InputGeoPointClass)
}) {
	.GeoPoint = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaGeoPoint) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaGeoPoint",
		ID:   InputMediaGeoPointTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GeoPoint",
			SchemaName: "geo_point",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputMediaGeoPoint) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaGeoPoint#f9c44144 as nil")
	}
	.PutID(InputMediaGeoPointTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaGeoPoint) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaGeoPoint#f9c44144 as nil")
	}
	if .GeoPoint == nil {
		return fmt.Errorf("unable to encode inputMediaGeoPoint#f9c44144: field geo_point is nil")
	}
	if  := .GeoPoint.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaGeoPoint#f9c44144: field geo_point: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaGeoPoint) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaGeoPoint#f9c44144 to nil")
	}
	{
		,  := DecodeInputGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaGeoPoint#f9c44144: field geo_point: %w", )
		}
		.GeoPoint = 
	}
	return nil
}

// GetGeoPoint returns value of GeoPoint field.
func ( *InputMediaGeoPoint) () ( InputGeoPointClass) {
	if  == nil {
		return
	}
	return .GeoPoint
}

// InputMediaContact represents TL type `inputMediaContact#f8ab7dfb`.
// Phone book contact
//
// See https://core.telegram.org/constructor/inputMediaContact for reference.
type InputMediaContact struct {
	// Phone number
	PhoneNumber string
	// Contact's first name
	FirstName string
	// Contact's last name
	LastName string
	// Contact vcard
	Vcard string
}

// InputMediaContactTypeID is TL type id of InputMediaContact.
const InputMediaContactTypeID = 0xf8ab7dfb

// construct implements constructor of InputMediaClass.
func ( InputMediaContact) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaContact{}
)

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

	return true
}

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

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

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaContact) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaContact",
		ID:   InputMediaContactTypeID,
	}
	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",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaContact#f8ab7dfb as nil")
	}
	.PutID(InputMediaContactTypeID)
	return .EncodeBare()
}

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

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

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

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

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

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

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

// InputMediaUploadedDocument represents TL type `inputMediaUploadedDocument#37c9330`.
// New document
//
// See https://core.telegram.org/constructor/inputMediaUploadedDocument for reference.
type InputMediaUploadedDocument struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to send the file as a video even if it doesn't have an audio track (i.e. if
	// set, the documentAttributeAnimated¹ attribute will not be set even for videos without
	// audio)
	//
	// Links:
	//  1) https://core.telegram.org/constructor/documentAttributeAnimated
	NosoundVideo bool
	// Force the media file to be uploaded as document
	ForceFile bool
	// Whether this media should be hidden behind a spoiler warning
	Spoiler bool
	// The uploaded file¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files
	File InputFileClass
	// Thumbnail of the document, uploaded as for the file
	//
	// Use SetThumb and GetThumb helpers.
	Thumb InputFileClass
	// MIME type of document
	MimeType string
	// Attributes that specify the type of the document (video, audio, voice, sticker, etc.)
	Attributes []DocumentAttributeClass
	// Attached stickers
	//
	// Use SetStickers and GetStickers helpers.
	Stickers []InputDocumentClass
	// Start playing the video at the specified timestamp (seconds).
	//
	// Use SetVideoCover and GetVideoCover helpers.
	VideoCover InputPhotoClass
	// Start playing the video at the specified timestamp (seconds).
	//
	// Use SetVideoTimestamp and GetVideoTimestamp helpers.
	VideoTimestamp int
	// Time to live in seconds of self-destructing document
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
}

// InputMediaUploadedDocumentTypeID is TL type id of InputMediaUploadedDocument.
const InputMediaUploadedDocumentTypeID = 0x37c9330

// construct implements constructor of InputMediaClass.
func ( InputMediaUploadedDocument) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaUploadedDocument{}
)

func ( *InputMediaUploadedDocument) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.NosoundVideo == false) {
		return false
	}
	if !(.ForceFile == false) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.File == nil) {
		return false
	}
	if !(.Thumb == nil) {
		return false
	}
	if !(.MimeType == "") {
		return false
	}
	if !(.Attributes == nil) {
		return false
	}
	if !(.Stickers == nil) {
		return false
	}
	if !(.VideoCover == nil) {
		return false
	}
	if !(.VideoTimestamp == 0) {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaUploadedDocument from given interface.
func ( *InputMediaUploadedDocument) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( InputFileClass)
	() ( InputFileClass,  bool)
	() ( string)
	() ( []DocumentAttributeClass)
	() ( []InputDocumentClass,  bool)
	() ( InputPhotoClass,  bool)
	() ( int,  bool)
	() ( int,  bool)
}) {
	.NosoundVideo = .()
	.ForceFile = .()
	.Spoiler = .()
	.File = .()
	if ,  := .();  {
		.Thumb = 
	}

	.MimeType = .()
	.Attributes = .()
	if ,  := .();  {
		.Stickers = 
	}

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

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaUploadedDocument) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaUploadedDocument",
		ID:   InputMediaUploadedDocumentTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "NosoundVideo",
			SchemaName: "nosound_video",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "ForceFile",
			SchemaName: "force_file",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "File",
			SchemaName: "file",
		},
		{
			Name:       "Thumb",
			SchemaName: "thumb",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "MimeType",
			SchemaName: "mime_type",
		},
		{
			Name:       "Attributes",
			SchemaName: "attributes",
		},
		{
			Name:       "Stickers",
			SchemaName: "stickers",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "VideoCover",
			SchemaName: "video_cover",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "VideoTimestamp",
			SchemaName: "video_timestamp",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaUploadedDocument) () {
	if !(.NosoundVideo == false) {
		.Flags.Set(3)
	}
	if !(.ForceFile == false) {
		.Flags.Set(4)
	}
	if !(.Spoiler == false) {
		.Flags.Set(5)
	}
	if !(.Thumb == nil) {
		.Flags.Set(2)
	}
	if !(.Stickers == nil) {
		.Flags.Set(0)
	}
	if !(.VideoCover == nil) {
		.Flags.Set(6)
	}
	if !(.VideoTimestamp == 0) {
		.Flags.Set(7)
	}
	if !(.TTLSeconds == 0) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaUploadedDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaUploadedDocument#37c9330 as nil")
	}
	.PutID(InputMediaUploadedDocumentTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaUploadedDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaUploadedDocument#37c9330 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field flags: %w", )
	}
	if .File == nil {
		return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field file is nil")
	}
	if  := .File.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field file: %w", )
	}
	if .Flags.Has(2) {
		if .Thumb == nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field thumb is nil")
		}
		if  := .Thumb.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field thumb: %w", )
		}
	}
	.PutString(.MimeType)
	.PutVectorHeader(len(.Attributes))
	for ,  := range .Attributes {
		if  == nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field attributes element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field attributes element with index %d: %w", , )
		}
	}
	if .Flags.Has(0) {
		.PutVectorHeader(len(.Stickers))
		for ,  := range .Stickers {
			if  == nil {
				return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field stickers element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field stickers element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(6) {
		if .VideoCover == nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field video_cover is nil")
		}
		if  := .VideoCover.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#37c9330: field video_cover: %w", )
		}
	}
	if .Flags.Has(7) {
		.PutInt(.VideoTimestamp)
	}
	if .Flags.Has(1) {
		.PutInt(.TTLSeconds)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaUploadedDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaUploadedDocument#37c9330 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field flags: %w", )
		}
	}
	.NosoundVideo = .Flags.Has(3)
	.ForceFile = .Flags.Has(4)
	.Spoiler = .Flags.Has(5)
	{
		,  := DecodeInputFile()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field file: %w", )
		}
		.File = 
	}
	if .Flags.Has(2) {
		,  := DecodeInputFile()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field thumb: %w", )
		}
		.Thumb = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field mime_type: %w", )
		}
		.MimeType = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field attributes: %w", )
		}

		if  > 0 {
			.Attributes = make([]DocumentAttributeClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeDocumentAttribute()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field attributes: %w", )
			}
			.Attributes = append(.Attributes, )
		}
	}
	if .Flags.Has(0) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field stickers: %w", )
		}

		if  > 0 {
			.Stickers = make([]InputDocumentClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputDocument()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field stickers: %w", )
			}
			.Stickers = append(.Stickers, )
		}
	}
	if .Flags.Has(6) {
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field video_cover: %w", )
		}
		.VideoCover = 
	}
	if .Flags.Has(7) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field video_timestamp: %w", )
		}
		.VideoTimestamp = 
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#37c9330: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	return nil
}

// SetNosoundVideo sets value of NosoundVideo conditional field.
func ( *InputMediaUploadedDocument) ( bool) {
	if  {
		.Flags.Set(3)
		.NosoundVideo = true
	} else {
		.Flags.Unset(3)
		.NosoundVideo = false
	}
}

// GetNosoundVideo returns value of NosoundVideo conditional field.
func ( *InputMediaUploadedDocument) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetForceFile sets value of ForceFile conditional field.
func ( *InputMediaUploadedDocument) ( bool) {
	if  {
		.Flags.Set(4)
		.ForceFile = true
	} else {
		.Flags.Unset(4)
		.ForceFile = false
	}
}

// GetForceFile returns value of ForceFile conditional field.
func ( *InputMediaUploadedDocument) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

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

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

// GetFile returns value of File field.
func ( *InputMediaUploadedDocument) () ( InputFileClass) {
	if  == nil {
		return
	}
	return .File
}

// SetThumb sets value of Thumb conditional field.
func ( *InputMediaUploadedDocument) ( InputFileClass) {
	.Flags.Set(2)
	.Thumb = 
}

// GetThumb returns value of Thumb conditional field and
// boolean which is true if field was set.
func ( *InputMediaUploadedDocument) () ( InputFileClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Thumb, true
}

// GetMimeType returns value of MimeType field.
func ( *InputMediaUploadedDocument) () ( string) {
	if  == nil {
		return
	}
	return .MimeType
}

// GetAttributes returns value of Attributes field.
func ( *InputMediaUploadedDocument) () ( []DocumentAttributeClass) {
	if  == nil {
		return
	}
	return .Attributes
}

// SetStickers sets value of Stickers conditional field.
func ( *InputMediaUploadedDocument) ( []InputDocumentClass) {
	.Flags.Set(0)
	.Stickers = 
}

// GetStickers returns value of Stickers conditional field and
// boolean which is true if field was set.
func ( *InputMediaUploadedDocument) () ( []InputDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Stickers, true
}

// SetVideoCover sets value of VideoCover conditional field.
func ( *InputMediaUploadedDocument) ( InputPhotoClass) {
	.Flags.Set(6)
	.VideoCover = 
}

// GetVideoCover returns value of VideoCover conditional field and
// boolean which is true if field was set.
func ( *InputMediaUploadedDocument) () ( InputPhotoClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(6) {
		return , false
	}
	return .VideoCover, true
}

// SetVideoTimestamp sets value of VideoTimestamp conditional field.
func ( *InputMediaUploadedDocument) ( int) {
	.Flags.Set(7)
	.VideoTimestamp = 
}

// GetVideoTimestamp returns value of VideoTimestamp conditional field and
// boolean which is true if field was set.
func ( *InputMediaUploadedDocument) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(7) {
		return , false
	}
	return .VideoTimestamp, true
}

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

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

// MapAttributes returns field Attributes wrapped in DocumentAttributeClassArray helper.
func ( *InputMediaUploadedDocument) () ( DocumentAttributeClassArray) {
	return DocumentAttributeClassArray(.Attributes)
}

// MapStickers returns field Stickers wrapped in InputDocumentClassArray helper.
func ( *InputMediaUploadedDocument) () ( InputDocumentClassArray,  bool) {
	if !.Flags.Has(0) {
		return , false
	}
	return InputDocumentClassArray(.Stickers), true
}

// InputMediaDocument represents TL type `inputMediaDocument#a8763ab5`.
// Forwarded document
//
// See https://core.telegram.org/constructor/inputMediaDocument for reference.
type InputMediaDocument 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
	// The document to be forwarded.
	ID InputDocumentClass
	// Custom video cover.
	//
	// Use SetVideoCover and GetVideoCover helpers.
	VideoCover InputPhotoClass
	// Start playing the video at the specified timestamp (seconds).
	//
	// Use SetVideoTimestamp and GetVideoTimestamp helpers.
	VideoTimestamp int
	// Time to live of self-destructing document
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
	// Text query or emoji that was used by the user to find this sticker or GIF: used to
	// improve search result relevance.
	//
	// Use SetQuery and GetQuery helpers.
	Query string
}

// InputMediaDocumentTypeID is TL type id of InputMediaDocument.
const InputMediaDocumentTypeID = 0xa8763ab5

// construct implements constructor of InputMediaClass.
func ( InputMediaDocument) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaDocument{}
)

func ( *InputMediaDocument) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.ID == nil) {
		return false
	}
	if !(.VideoCover == nil) {
		return false
	}
	if !(.VideoTimestamp == 0) {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}
	if !(.Query == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaDocument from given interface.
func ( *InputMediaDocument) ( interface {
	() ( bool)
	() ( InputDocumentClass)
	() ( InputPhotoClass,  bool)
	() ( int,  bool)
	() ( int,  bool)
	() ( string,  bool)
}) {
	.Spoiler = .()
	.ID = .()
	if ,  := .();  {
		.VideoCover = 
	}

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

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaDocument) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaDocument",
		ID:   InputMediaDocumentTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "VideoCover",
			SchemaName: "video_cover",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "VideoTimestamp",
			SchemaName: "video_timestamp",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Query",
			SchemaName: "query",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaDocument) () {
	if !(.Spoiler == false) {
		.Flags.Set(2)
	}
	if !(.VideoCover == nil) {
		.Flags.Set(3)
	}
	if !(.VideoTimestamp == 0) {
		.Flags.Set(4)
	}
	if !(.TTLSeconds == 0) {
		.Flags.Set(0)
	}
	if !(.Query == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDocument#a8763ab5 as nil")
	}
	.PutID(InputMediaDocumentTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDocument#a8763ab5 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaDocument#a8763ab5: field flags: %w", )
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode inputMediaDocument#a8763ab5: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaDocument#a8763ab5: field id: %w", )
	}
	if .Flags.Has(3) {
		if .VideoCover == nil {
			return fmt.Errorf("unable to encode inputMediaDocument#a8763ab5: field video_cover is nil")
		}
		if  := .VideoCover.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaDocument#a8763ab5: field video_cover: %w", )
		}
	}
	if .Flags.Has(4) {
		.PutInt(.VideoTimestamp)
	}
	if .Flags.Has(0) {
		.PutInt(.TTLSeconds)
	}
	if .Flags.Has(1) {
		.PutString(.Query)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaDocument#a8763ab5 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#a8763ab5: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(2)
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#a8763ab5: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(3) {
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#a8763ab5: field video_cover: %w", )
		}
		.VideoCover = 
	}
	if .Flags.Has(4) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#a8763ab5: field video_timestamp: %w", )
		}
		.VideoTimestamp = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#a8763ab5: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#a8763ab5: field query: %w", )
		}
		.Query = 
	}
	return nil
}

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

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

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

// SetVideoCover sets value of VideoCover conditional field.
func ( *InputMediaDocument) ( InputPhotoClass) {
	.Flags.Set(3)
	.VideoCover = 
}

// GetVideoCover returns value of VideoCover conditional field and
// boolean which is true if field was set.
func ( *InputMediaDocument) () ( InputPhotoClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .VideoCover, true
}

// SetVideoTimestamp sets value of VideoTimestamp conditional field.
func ( *InputMediaDocument) ( int) {
	.Flags.Set(4)
	.VideoTimestamp = 
}

// GetVideoTimestamp returns value of VideoTimestamp conditional field and
// boolean which is true if field was set.
func ( *InputMediaDocument) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .VideoTimestamp, true
}

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

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

// SetQuery sets value of Query conditional field.
func ( *InputMediaDocument) ( string) {
	.Flags.Set(1)
	.Query = 
}

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

// InputMediaVenue represents TL type `inputMediaVenue#c13d1c11`.
// Can be used to send a venue geolocation.
//
// See https://core.telegram.org/constructor/inputMediaVenue for reference.
type InputMediaVenue struct {
	// Geolocation
	GeoPoint InputGeoPointClass
	// Venue name
	Title string
	// Physical address of the venue
	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
}

// InputMediaVenueTypeID is TL type id of InputMediaVenue.
const InputMediaVenueTypeID = 0xc13d1c11

// construct implements constructor of InputMediaClass.
func ( InputMediaVenue) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaVenue{}
)

func ( *InputMediaVenue) () bool {
	if  == nil {
		return true
	}
	if !(.GeoPoint == 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 ( *InputMediaVenue) () string {
	if  == nil {
		return "InputMediaVenue(nil)"
	}
	type  InputMediaVenue
	return fmt.Sprintf("InputMediaVenue%+v", (*))
}

// FillFrom fills InputMediaVenue from given interface.
func ( *InputMediaVenue) ( interface {
	() ( InputGeoPointClass)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
}) {
	.GeoPoint = .()
	.Title = .()
	.Address = .()
	.Provider = .()
	.VenueID = .()
	.VenueType = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaVenue) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaVenue",
		ID:   InputMediaVenueTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GeoPoint",
			SchemaName: "geo_point",
		},
		{
			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 ( *InputMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaVenue#c13d1c11 as nil")
	}
	.PutID(InputMediaVenueTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaVenue#c13d1c11 to nil")
	}
	{
		,  := DecodeInputGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaVenue#c13d1c11: field geo_point: %w", )
		}
		.GeoPoint = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaVenue#c13d1c11: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaVenue#c13d1c11: field address: %w", )
		}
		.Address = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaVenue#c13d1c11: field provider: %w", )
		}
		.Provider = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaVenue#c13d1c11: field venue_id: %w", )
		}
		.VenueID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaVenue#c13d1c11: field venue_type: %w", )
		}
		.VenueType = 
	}
	return nil
}

// GetGeoPoint returns value of GeoPoint field.
func ( *InputMediaVenue) () ( InputGeoPointClass) {
	if  == nil {
		return
	}
	return .GeoPoint
}

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

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

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

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

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

// InputMediaPhotoExternal represents TL type `inputMediaPhotoExternal#e5bbfe1a`.
// New photo that will be uploaded by the server using the specified URL
//
// See https://core.telegram.org/constructor/inputMediaPhotoExternal for reference.
type InputMediaPhotoExternal 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
	// URL of the photo
	URL string
	// Self-destruct time to live of photo
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
}

// InputMediaPhotoExternalTypeID is TL type id of InputMediaPhotoExternal.
const InputMediaPhotoExternalTypeID = 0xe5bbfe1a

// construct implements constructor of InputMediaClass.
func ( InputMediaPhotoExternal) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaPhotoExternal{}
)

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

	return true
}

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

// FillFrom fills InputMediaPhotoExternal from given interface.
func ( *InputMediaPhotoExternal) ( interface {
	() ( bool)
	() ( string)
	() ( int,  bool)
}) {
	.Spoiler = .()
	.URL = .()
	if ,  := .();  {
		.TTLSeconds = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaPhotoExternal) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaPhotoExternal",
		ID:   InputMediaPhotoExternalTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaPhotoExternal) () {
	if !(.Spoiler == false) {
		.Flags.Set(1)
	}
	if !(.TTLSeconds == 0) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaPhotoExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPhotoExternal#e5bbfe1a as nil")
	}
	.PutID(InputMediaPhotoExternalTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaPhotoExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPhotoExternal#e5bbfe1a as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPhotoExternal#e5bbfe1a: field flags: %w", )
	}
	.PutString(.URL)
	if .Flags.Has(0) {
		.PutInt(.TTLSeconds)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaPhotoExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaPhotoExternal#e5bbfe1a to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaPhotoExternal#e5bbfe1a: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(1)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhotoExternal#e5bbfe1a: field url: %w", )
		}
		.URL = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhotoExternal#e5bbfe1a: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	return nil
}

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

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

// GetURL returns value of URL field.
func ( *InputMediaPhotoExternal) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

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

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

// InputMediaDocumentExternal represents TL type `inputMediaDocumentExternal#779600f9`.
// Document that will be downloaded by the telegram servers
//
// See https://core.telegram.org/constructor/inputMediaDocumentExternal for reference.
type InputMediaDocumentExternal 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
	// URL of the document
	URL string
	// Self-destruct time to live of document
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
	// Custom video cover.
	//
	// Use SetVideoCover and GetVideoCover helpers.
	VideoCover InputPhotoClass
	// Start playing the video at the specified timestamp (seconds).
	//
	// Use SetVideoTimestamp and GetVideoTimestamp helpers.
	VideoTimestamp int
}

// InputMediaDocumentExternalTypeID is TL type id of InputMediaDocumentExternal.
const InputMediaDocumentExternalTypeID = 0x779600f9

// construct implements constructor of InputMediaClass.
func ( InputMediaDocumentExternal) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaDocumentExternal{}
)

func ( *InputMediaDocumentExternal) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Spoiler == false) {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.TTLSeconds == 0) {
		return false
	}
	if !(.VideoCover == nil) {
		return false
	}
	if !(.VideoTimestamp == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaDocumentExternal from given interface.
func ( *InputMediaDocumentExternal) ( interface {
	() ( bool)
	() ( string)
	() ( int,  bool)
	() ( InputPhotoClass,  bool)
	() ( int,  bool)
}) {
	.Spoiler = .()
	.URL = .()
	if ,  := .();  {
		.TTLSeconds = 
	}

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaDocumentExternal) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaDocumentExternal",
		ID:   InputMediaDocumentExternalTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Spoiler",
			SchemaName: "spoiler",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "VideoCover",
			SchemaName: "video_cover",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "VideoTimestamp",
			SchemaName: "video_timestamp",
			Null:       !.Flags.Has(3),
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *InputMediaDocumentExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDocumentExternal#779600f9 as nil")
	}
	.PutID(InputMediaDocumentExternalTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaDocumentExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDocumentExternal#779600f9 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaDocumentExternal#779600f9: field flags: %w", )
	}
	.PutString(.URL)
	if .Flags.Has(0) {
		.PutInt(.TTLSeconds)
	}
	if .Flags.Has(2) {
		if .VideoCover == nil {
			return fmt.Errorf("unable to encode inputMediaDocumentExternal#779600f9: field video_cover is nil")
		}
		if  := .VideoCover.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaDocumentExternal#779600f9: field video_cover: %w", )
		}
	}
	if .Flags.Has(3) {
		.PutInt(.VideoTimestamp)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaDocumentExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaDocumentExternal#779600f9 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#779600f9: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(1)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#779600f9: field url: %w", )
		}
		.URL = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#779600f9: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	if .Flags.Has(2) {
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#779600f9: field video_cover: %w", )
		}
		.VideoCover = 
	}
	if .Flags.Has(3) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#779600f9: field video_timestamp: %w", )
		}
		.VideoTimestamp = 
	}
	return nil
}

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

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

// GetURL returns value of URL field.
func ( *InputMediaDocumentExternal) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

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

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

// SetVideoCover sets value of VideoCover conditional field.
func ( *InputMediaDocumentExternal) ( InputPhotoClass) {
	.Flags.Set(2)
	.VideoCover = 
}

// GetVideoCover returns value of VideoCover conditional field and
// boolean which is true if field was set.
func ( *InputMediaDocumentExternal) () ( InputPhotoClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .VideoCover, true
}

// SetVideoTimestamp sets value of VideoTimestamp conditional field.
func ( *InputMediaDocumentExternal) ( int) {
	.Flags.Set(3)
	.VideoTimestamp = 
}

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

// InputMediaGame represents TL type `inputMediaGame#d33f43f3`.
// A game
//
// See https://core.telegram.org/constructor/inputMediaGame for reference.
type InputMediaGame struct {
	// The game to forward
	ID InputGameClass
}

// InputMediaGameTypeID is TL type id of InputMediaGame.
const InputMediaGameTypeID = 0xd33f43f3

// construct implements constructor of InputMediaClass.
func ( InputMediaGame) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaGame{}
)

func ( *InputMediaGame) () bool {
	if  == nil {
		return true
	}
	if !(.ID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaGame from given interface.
func ( *InputMediaGame) ( interface {
	() ( InputGameClass)
}) {
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaGame) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaGame",
		ID:   InputMediaGameTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaGame#d33f43f3 as nil")
	}
	.PutID(InputMediaGameTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaGame#d33f43f3 as nil")
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode inputMediaGame#d33f43f3: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaGame#d33f43f3: field id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaGame#d33f43f3 to nil")
	}
	{
		,  := DecodeInputGame()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaGame#d33f43f3: field id: %w", )
		}
		.ID = 
	}
	return nil
}

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

// InputMediaInvoice represents TL type `inputMediaInvoice#405fef0d`.
// Generated invoice of a bot payment¹
//
// Links:
//  1. https://core.telegram.org/bots/payments
//
// See https://core.telegram.org/constructor/inputMediaInvoice for reference.
type InputMediaInvoice struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// 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 InputWebDocument
	// The actual invoice
	Invoice Invoice
	// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use
	// for your internal processes.
	Payload []byte
	// Payments provider token, obtained via Botfather¹
	//
	// Links:
	//  1) https://t.me/botfather
	//
	// Use SetProvider and GetProvider helpers.
	Provider string
	// JSON-encoded data about the invoice, which will be shared with the payment provider. A
	// detailed description of required fields should be provided by the payment provider.
	ProviderData DataJSON
	// Unique bot deep links start parameter¹. If present, forwarded copies of the sent
	// message will have a URL button with a deep link² to the bot (instead of a Pay button)
	// with the value used as the start parameter. If absent, forwarded copies of the sent
	// message will have a Pay button, allowing multiple users to pay directly from the
	// forwarded message, using the same invoice.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#bot-links
	//  2) https://core.telegram.org/api/links#bot-links
	//
	// Use SetStartParam and GetStartParam helpers.
	StartParam string
	// Deprecated
	//
	// Use SetExtendedMedia and GetExtendedMedia helpers.
	ExtendedMedia InputMediaClass
}

// InputMediaInvoiceTypeID is TL type id of InputMediaInvoice.
const InputMediaInvoiceTypeID = 0x405fef0d

// construct implements constructor of InputMediaClass.
func ( InputMediaInvoice) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaInvoice{}
)

func ( *InputMediaInvoice) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Description == "") {
		return false
	}
	if !(.Photo.Zero()) {
		return false
	}
	if !(.Invoice.Zero()) {
		return false
	}
	if !(.Payload == nil) {
		return false
	}
	if !(.Provider == "") {
		return false
	}
	if !(.ProviderData.Zero()) {
		return false
	}
	if !(.StartParam == "") {
		return false
	}
	if !(.ExtendedMedia == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaInvoice from given interface.
func ( *InputMediaInvoice) ( interface {
	() ( string)
	() ( string)
	() ( InputWebDocument,  bool)
	() ( Invoice)
	() ( []byte)
	() ( string,  bool)
	() ( DataJSON)
	() ( string,  bool)
	() ( InputMediaClass,  bool)
}) {
	.Title = .()
	.Description = .()
	if ,  := .();  {
		.Photo = 
	}

	.Invoice = .()
	.Payload = .()
	if ,  := .();  {
		.Provider = 
	}

	.ProviderData = .()
	if ,  := .();  {
		.StartParam = 
	}

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaInvoice) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaInvoice",
		ID:   InputMediaInvoiceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Description",
			SchemaName: "description",
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Invoice",
			SchemaName: "invoice",
		},
		{
			Name:       "Payload",
			SchemaName: "payload",
		},
		{
			Name:       "Provider",
			SchemaName: "provider",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "ProviderData",
			SchemaName: "provider_data",
		},
		{
			Name:       "StartParam",
			SchemaName: "start_param",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "ExtendedMedia",
			SchemaName: "extended_media",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaInvoice) () {
	if !(.Photo.Zero()) {
		.Flags.Set(0)
	}
	if !(.Provider == "") {
		.Flags.Set(3)
	}
	if !(.StartParam == "") {
		.Flags.Set(1)
	}
	if !(.ExtendedMedia == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaInvoice#405fef0d as nil")
	}
	.PutID(InputMediaInvoiceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaInvoice#405fef0d as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaInvoice#405fef0d: field flags: %w", )
	}
	.PutString(.Title)
	.PutString(.Description)
	if .Flags.Has(0) {
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaInvoice#405fef0d: field photo: %w", )
		}
	}
	if  := .Invoice.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaInvoice#405fef0d: field invoice: %w", )
	}
	.PutBytes(.Payload)
	if .Flags.Has(3) {
		.PutString(.Provider)
	}
	if  := .ProviderData.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaInvoice#405fef0d: field provider_data: %w", )
	}
	if .Flags.Has(1) {
		.PutString(.StartParam)
	}
	if .Flags.Has(2) {
		if .ExtendedMedia == nil {
			return fmt.Errorf("unable to encode inputMediaInvoice#405fef0d: field extended_media is nil")
		}
		if  := .ExtendedMedia.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaInvoice#405fef0d: field extended_media: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaInvoice#405fef0d to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field description: %w", )
		}
		.Description = 
	}
	if .Flags.Has(0) {
		if  := .Photo.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field photo: %w", )
		}
	}
	{
		if  := .Invoice.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field invoice: %w", )
		}
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field payload: %w", )
		}
		.Payload = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field provider: %w", )
		}
		.Provider = 
	}
	{
		if  := .ProviderData.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field provider_data: %w", )
		}
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field start_param: %w", )
		}
		.StartParam = 
	}
	if .Flags.Has(2) {
		,  := DecodeInputMedia()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaInvoice#405fef0d: field extended_media: %w", )
		}
		.ExtendedMedia = 
	}
	return nil
}

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

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

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

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

// GetInvoice returns value of Invoice field.
func ( *InputMediaInvoice) () ( Invoice) {
	if  == nil {
		return
	}
	return .Invoice
}

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

// SetProvider sets value of Provider conditional field.
func ( *InputMediaInvoice) ( string) {
	.Flags.Set(3)
	.Provider = 
}

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

// GetProviderData returns value of ProviderData field.
func ( *InputMediaInvoice) () ( DataJSON) {
	if  == nil {
		return
	}
	return .ProviderData
}

// SetStartParam sets value of StartParam conditional field.
func ( *InputMediaInvoice) ( string) {
	.Flags.Set(1)
	.StartParam = 
}

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

// SetExtendedMedia sets value of ExtendedMedia conditional field.
func ( *InputMediaInvoice) ( InputMediaClass) {
	.Flags.Set(2)
	.ExtendedMedia = 
}

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

// InputMediaGeoLive represents TL type `inputMediaGeoLive#971fa843`.
// Live geolocation¹
//
// Links:
//  1. https://core.telegram.org/api/live-location
//
// See https://core.telegram.org/constructor/inputMediaGeoLive for reference.
type InputMediaGeoLive struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether sending of the geolocation was stopped
	Stopped bool
	// Current geolocation
	GeoPoint InputGeoPointClass
	// 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 the current location
	//
	// Use SetPeriod and GetPeriod helpers.
	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
}

// InputMediaGeoLiveTypeID is TL type id of InputMediaGeoLive.
const InputMediaGeoLiveTypeID = 0x971fa843

// construct implements constructor of InputMediaClass.
func ( InputMediaGeoLive) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaGeoLive{}
)

func ( *InputMediaGeoLive) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Stopped == false) {
		return false
	}
	if !(.GeoPoint == 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 ( *InputMediaGeoLive) () string {
	if  == nil {
		return "InputMediaGeoLive(nil)"
	}
	type  InputMediaGeoLive
	return fmt.Sprintf("InputMediaGeoLive%+v", (*))
}

// FillFrom fills InputMediaGeoLive from given interface.
func ( *InputMediaGeoLive) ( interface {
	() ( bool)
	() ( InputGeoPointClass)
	() ( int,  bool)
	() ( int,  bool)
	() ( int,  bool)
}) {
	.Stopped = .()
	.GeoPoint = .()
	if ,  := .();  {
		.Heading = 
	}

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaGeoLive) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaGeoLive",
		ID:   InputMediaGeoLiveTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Stopped",
			SchemaName: "stopped",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "GeoPoint",
			SchemaName: "geo_point",
		},
		{
			Name:       "Heading",
			SchemaName: "heading",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Period",
			SchemaName: "period",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "ProximityNotificationRadius",
			SchemaName: "proximity_notification_radius",
			Null:       !.Flags.Has(3),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaGeoLive) () {
	if !(.Stopped == false) {
		.Flags.Set(0)
	}
	if !(.Heading == 0) {
		.Flags.Set(2)
	}
	if !(.Period == 0) {
		.Flags.Set(1)
	}
	if !(.ProximityNotificationRadius == 0) {
		.Flags.Set(3)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaGeoLive#971fa843 as nil")
	}
	.PutID(InputMediaGeoLiveTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaGeoLive#971fa843 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaGeoLive#971fa843: field flags: %w", )
	}
	if .GeoPoint == nil {
		return fmt.Errorf("unable to encode inputMediaGeoLive#971fa843: field geo_point is nil")
	}
	if  := .GeoPoint.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaGeoLive#971fa843: field geo_point: %w", )
	}
	if .Flags.Has(2) {
		.PutInt(.Heading)
	}
	if .Flags.Has(1) {
		.PutInt(.Period)
	}
	if .Flags.Has(3) {
		.PutInt(.ProximityNotificationRadius)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaGeoLive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaGeoLive#971fa843 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaGeoLive#971fa843: field flags: %w", )
		}
	}
	.Stopped = .Flags.Has(0)
	{
		,  := DecodeInputGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaGeoLive#971fa843: field geo_point: %w", )
		}
		.GeoPoint = 
	}
	if .Flags.Has(2) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaGeoLive#971fa843: field heading: %w", )
		}
		.Heading = 
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaGeoLive#971fa843: field period: %w", )
		}
		.Period = 
	}
	if .Flags.Has(3) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaGeoLive#971fa843: field proximity_notification_radius: %w", )
		}
		.ProximityNotificationRadius = 
	}
	return nil
}

// SetStopped sets value of Stopped conditional field.
func ( *InputMediaGeoLive) ( bool) {
	if  {
		.Flags.Set(0)
		.Stopped = true
	} else {
		.Flags.Unset(0)
		.Stopped = false
	}
}

// GetStopped returns value of Stopped conditional field.
func ( *InputMediaGeoLive) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetGeoPoint returns value of GeoPoint field.
func ( *InputMediaGeoLive) () ( InputGeoPointClass) {
	if  == nil {
		return
	}
	return .GeoPoint
}

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

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

// SetPeriod sets value of Period conditional field.
func ( *InputMediaGeoLive) ( int) {
	.Flags.Set(1)
	.Period = 
}

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

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

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

// InputMediaPoll represents TL type `inputMediaPoll#883a4108`.
// A poll
//
// See https://core.telegram.org/constructor/inputMediaPoll for reference.
type InputMediaPoll struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// The poll to send
	Poll Poll
	// Correct answer IDs (for quiz polls)
	//
	// Use SetCorrectAnswers and GetCorrectAnswers helpers.
	CorrectAnswers []int
	// AttachedMedia field of InputMediaPoll.
	//
	// Use SetAttachedMedia and GetAttachedMedia helpers.
	AttachedMedia InputMediaClass
	// Explanation of quiz solution
	//
	// Use SetSolution and GetSolution helpers.
	Solution string
	// Message entities for styled text¹
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	//
	// Use SetSolutionEntities and GetSolutionEntities helpers.
	SolutionEntities []MessageEntityClass
	// SolutionMedia field of InputMediaPoll.
	//
	// Use SetSolutionMedia and GetSolutionMedia helpers.
	SolutionMedia InputMediaClass
}

// InputMediaPollTypeID is TL type id of InputMediaPoll.
const InputMediaPollTypeID = 0x883a4108

// construct implements constructor of InputMediaClass.
func ( InputMediaPoll) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaPoll{}
)

func ( *InputMediaPoll) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Poll.Zero()) {
		return false
	}
	if !(.CorrectAnswers == nil) {
		return false
	}
	if !(.AttachedMedia == nil) {
		return false
	}
	if !(.Solution == "") {
		return false
	}
	if !(.SolutionEntities == nil) {
		return false
	}
	if !(.SolutionMedia == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaPoll from given interface.
func ( *InputMediaPoll) ( interface {
	() ( Poll)
	() ( []int,  bool)
	() ( InputMediaClass,  bool)
	() ( string,  bool)
	() ( []MessageEntityClass,  bool)
	() ( InputMediaClass,  bool)
}) {
	.Poll = .()
	if ,  := .();  {
		.CorrectAnswers = 
	}

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

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

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaPoll) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaPoll",
		ID:   InputMediaPollTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Poll",
			SchemaName: "poll",
		},
		{
			Name:       "CorrectAnswers",
			SchemaName: "correct_answers",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "AttachedMedia",
			SchemaName: "attached_media",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Solution",
			SchemaName: "solution",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "SolutionEntities",
			SchemaName: "solution_entities",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "SolutionMedia",
			SchemaName: "solution_media",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaPoll) () {
	if !(.CorrectAnswers == nil) {
		.Flags.Set(0)
	}
	if !(.AttachedMedia == nil) {
		.Flags.Set(3)
	}
	if !(.Solution == "") {
		.Flags.Set(1)
	}
	if !(.SolutionEntities == nil) {
		.Flags.Set(1)
	}
	if !(.SolutionMedia == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPoll#883a4108 as nil")
	}
	.PutID(InputMediaPollTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPoll#883a4108 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field flags: %w", )
	}
	if  := .Poll.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field poll: %w", )
	}
	if .Flags.Has(0) {
		.PutVectorHeader(len(.CorrectAnswers))
		for ,  := range .CorrectAnswers {
			.PutInt()
		}
	}
	if .Flags.Has(3) {
		if .AttachedMedia == nil {
			return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field attached_media is nil")
		}
		if  := .AttachedMedia.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field attached_media: %w", )
		}
	}
	if .Flags.Has(1) {
		.PutString(.Solution)
	}
	if .Flags.Has(1) {
		.PutVectorHeader(len(.SolutionEntities))
		for ,  := range .SolutionEntities {
			if  == nil {
				return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_entities element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(2) {
		if .SolutionMedia == nil {
			return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_media is nil")
		}
		if  := .SolutionMedia.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaPoll#883a4108: field solution_media: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaPoll#883a4108 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field flags: %w", )
		}
	}
	{
		if  := .Poll.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field poll: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field correct_answers: %w", )
		}

		if  > 0 {
			.CorrectAnswers = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field correct_answers: %w", )
			}
			.CorrectAnswers = append(.CorrectAnswers, )
		}
	}
	if .Flags.Has(3) {
		,  := DecodeInputMedia()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field attached_media: %w", )
		}
		.AttachedMedia = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution: %w", )
		}
		.Solution = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution_entities: %w", )
		}

		if  > 0 {
			.SolutionEntities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution_entities: %w", )
			}
			.SolutionEntities = append(.SolutionEntities, )
		}
	}
	if .Flags.Has(2) {
		,  := DecodeInputMedia()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPoll#883a4108: field solution_media: %w", )
		}
		.SolutionMedia = 
	}
	return nil
}

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

// SetCorrectAnswers sets value of CorrectAnswers conditional field.
func ( *InputMediaPoll) ( []int) {
	.Flags.Set(0)
	.CorrectAnswers = 
}

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

// SetAttachedMedia sets value of AttachedMedia conditional field.
func ( *InputMediaPoll) ( InputMediaClass) {
	.Flags.Set(3)
	.AttachedMedia = 
}

// GetAttachedMedia returns value of AttachedMedia conditional field and
// boolean which is true if field was set.
func ( *InputMediaPoll) () ( InputMediaClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .AttachedMedia, true
}

// SetSolution sets value of Solution conditional field.
func ( *InputMediaPoll) ( string) {
	.Flags.Set(1)
	.Solution = 
}

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

// SetSolutionEntities sets value of SolutionEntities conditional field.
func ( *InputMediaPoll) ( []MessageEntityClass) {
	.Flags.Set(1)
	.SolutionEntities = 
}

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

// SetSolutionMedia sets value of SolutionMedia conditional field.
func ( *InputMediaPoll) ( InputMediaClass) {
	.Flags.Set(2)
	.SolutionMedia = 
}

// GetSolutionMedia returns value of SolutionMedia conditional field and
// boolean which is true if field was set.
func ( *InputMediaPoll) () ( InputMediaClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .SolutionMedia, true
}

// MapSolutionEntities returns field SolutionEntities wrapped in MessageEntityClassArray helper.
func ( *InputMediaPoll) () ( MessageEntityClassArray,  bool) {
	if !.Flags.Has(1) {
		return , false
	}
	return MessageEntityClassArray(.SolutionEntities), true
}

// InputMediaDice represents TL type `inputMediaDice#e66fbf7b`.
// Send a dice-based animated sticker¹
//
// Links:
//  1. https://core.telegram.org/api/dice
//
// See https://core.telegram.org/constructor/inputMediaDice for reference.
type InputMediaDice struct {
	// The emoji, for now ,  and  are supported
	Emoticon string
}

// InputMediaDiceTypeID is TL type id of InputMediaDice.
const InputMediaDiceTypeID = 0xe66fbf7b

// construct implements constructor of InputMediaClass.
func ( InputMediaDice) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaDice{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDice#e66fbf7b as nil")
	}
	.PutID(InputMediaDiceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDice#e66fbf7b as nil")
	}
	.PutString(.Emoticon)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaDice#e66fbf7b to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDice#e66fbf7b: field emoticon: %w", )
		}
		.Emoticon = 
	}
	return nil
}

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

// InputMediaStory represents TL type `inputMediaStory#89fdd778`.
// Forwarded story
//
// See https://core.telegram.org/constructor/inputMediaStory for reference.
type InputMediaStory struct {
	// Peer where the story was posted
	Peer InputPeerClass
	// Story ID
	ID int
}

// InputMediaStoryTypeID is TL type id of InputMediaStory.
const InputMediaStoryTypeID = 0x89fdd778

// construct implements constructor of InputMediaClass.
func ( InputMediaStory) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaStory{}
)

func ( *InputMediaStory) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaStory from given interface.
func ( *InputMediaStory) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaStory) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaStory",
		ID:   InputMediaStoryTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaStory#89fdd778 as nil")
	}
	.PutID(InputMediaStoryTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaStory#89fdd778 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode inputMediaStory#89fdd778: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaStory#89fdd778: field peer: %w", )
	}
	.PutInt(.ID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaStory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaStory#89fdd778 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaStory#89fdd778: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaStory#89fdd778: field id: %w", )
		}
		.ID = 
	}
	return nil
}

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

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

// InputMediaWebPage represents TL type `inputMediaWebPage#c21b8849`.
// Specifies options that will be used to generate the link preview for the caption, or
// even a standalone link preview without an attached message.
//
// See https://core.telegram.org/constructor/inputMediaWebPage for reference.
type InputMediaWebPage 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 not set, a WEBPAGE_NOT_FOUND RPC error will be emitted if a webpage preview cannot
	// be generated for the specified url; otherwise, no error will be emitted (unless the
	// provided message is also empty, in which case a MESSAGE_EMPTY will be emitted,
	// instead).
	Optional bool
	// The URL to use for the link preview.
	URL string
}

// InputMediaWebPageTypeID is TL type id of InputMediaWebPage.
const InputMediaWebPageTypeID = 0xc21b8849

// construct implements constructor of InputMediaClass.
func ( InputMediaWebPage) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaWebPage{}
)

func ( *InputMediaWebPage) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ForceLargeMedia == false) {
		return false
	}
	if !(.ForceSmallMedia == false) {
		return false
	}
	if !(.Optional == false) {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaWebPage from given interface.
func ( *InputMediaWebPage) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( string)
}) {
	.ForceLargeMedia = .()
	.ForceSmallMedia = .()
	.Optional = .()
	.URL = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaWebPage) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaWebPage",
		ID:   InputMediaWebPageTypeID,
	}
	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:       "Optional",
			SchemaName: "optional",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaWebPage) () {
	if !(.ForceLargeMedia == false) {
		.Flags.Set(0)
	}
	if !(.ForceSmallMedia == false) {
		.Flags.Set(1)
	}
	if !(.Optional == false) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaWebPage#c21b8849 as nil")
	}
	.PutID(InputMediaWebPageTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaWebPage#c21b8849 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaWebPage#c21b8849: field flags: %w", )
	}
	.PutString(.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaWebPage#c21b8849 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaWebPage#c21b8849: field flags: %w", )
		}
	}
	.ForceLargeMedia = .Flags.Has(0)
	.ForceSmallMedia = .Flags.Has(1)
	.Optional = .Flags.Has(2)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaWebPage#c21b8849: field url: %w", )
		}
		.URL = 
	}
	return nil
}

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

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

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

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

// SetOptional sets value of Optional conditional field.
func ( *InputMediaWebPage) ( bool) {
	if  {
		.Flags.Set(2)
		.Optional = true
	} else {
		.Flags.Unset(2)
		.Optional = false
	}
}

// GetOptional returns value of Optional conditional field.
func ( *InputMediaWebPage) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// GetURL returns value of URL field.
func ( *InputMediaWebPage) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// InputMediaPaidMedia represents TL type `inputMediaPaidMedia#c4103386`.
// Paid media, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/paid-media
//
// See https://core.telegram.org/constructor/inputMediaPaidMedia for reference.
type InputMediaPaidMedia struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// The price of the media in Telegram Stars¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/stars
	StarsAmount int64
	// Photos or videos.
	ExtendedMedia []InputMediaClass
	// Bots only, specifies a custom payload that will then be passed in
	// updateBotPurchasedPaidMedia¹ when a payment is made (this field will not be visible
	// to the user)
	//
	// Links:
	//  1) https://core.telegram.org/constructor/updateBotPurchasedPaidMedia
	//
	// Use SetPayload and GetPayload helpers.
	Payload string
}

// InputMediaPaidMediaTypeID is TL type id of InputMediaPaidMedia.
const InputMediaPaidMediaTypeID = 0xc4103386

// construct implements constructor of InputMediaClass.
func ( InputMediaPaidMedia) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaPaidMedia{}
)

func ( *InputMediaPaidMedia) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.StarsAmount == 0) {
		return false
	}
	if !(.ExtendedMedia == nil) {
		return false
	}
	if !(.Payload == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaPaidMedia from given interface.
func ( *InputMediaPaidMedia) ( interface {
	() ( int64)
	() ( []InputMediaClass)
	() ( string,  bool)
}) {
	.StarsAmount = .()
	.ExtendedMedia = .()
	if ,  := .();  {
		.Payload = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaPaidMedia) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaPaidMedia",
		ID:   InputMediaPaidMediaTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "StarsAmount",
			SchemaName: "stars_amount",
		},
		{
			Name:       "ExtendedMedia",
			SchemaName: "extended_media",
		},
		{
			Name:       "Payload",
			SchemaName: "payload",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputMediaPaidMedia) () {
	if !(.Payload == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *InputMediaPaidMedia) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPaidMedia#c4103386 as nil")
	}
	.PutID(InputMediaPaidMediaTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaPaidMedia) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPaidMedia#c4103386 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPaidMedia#c4103386: field flags: %w", )
	}
	.PutLong(.StarsAmount)
	.PutVectorHeader(len(.ExtendedMedia))
	for ,  := range .ExtendedMedia {
		if  == nil {
			return fmt.Errorf("unable to encode inputMediaPaidMedia#c4103386: field extended_media element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaPaidMedia#c4103386: field extended_media element with index %d: %w", , )
		}
	}
	if .Flags.Has(0) {
		.PutString(.Payload)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaPaidMedia) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaPaidMedia#c4103386 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field flags: %w", )
		}
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field stars_amount: %w", )
		}
		.StarsAmount = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field extended_media: %w", )
		}

		if  > 0 {
			.ExtendedMedia = make([]InputMediaClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputMedia()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field extended_media: %w", )
			}
			.ExtendedMedia = append(.ExtendedMedia, )
		}
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPaidMedia#c4103386: field payload: %w", )
		}
		.Payload = 
	}
	return nil
}

// GetStarsAmount returns value of StarsAmount field.
func ( *InputMediaPaidMedia) () ( int64) {
	if  == nil {
		return
	}
	return .StarsAmount
}

// GetExtendedMedia returns value of ExtendedMedia field.
func ( *InputMediaPaidMedia) () ( []InputMediaClass) {
	if  == nil {
		return
	}
	return .ExtendedMedia
}

// SetPayload sets value of Payload conditional field.
func ( *InputMediaPaidMedia) ( string) {
	.Flags.Set(0)
	.Payload = 
}

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

// MapExtendedMedia returns field ExtendedMedia wrapped in InputMediaClassArray helper.
func ( *InputMediaPaidMedia) () ( InputMediaClassArray) {
	return InputMediaClassArray(.ExtendedMedia)
}

// InputMediaTodo represents TL type `inputMediaTodo#9fc55fde`.
// Creates a todo list »¹.
//
// Links:
//  1. https://core.telegram.org/api/todo
//
// See https://core.telegram.org/constructor/inputMediaTodo for reference.
type InputMediaTodo struct {
	// The todo list.
	Todo TodoList
}

// InputMediaTodoTypeID is TL type id of InputMediaTodo.
const InputMediaTodoTypeID = 0x9fc55fde

// construct implements constructor of InputMediaClass.
func ( InputMediaTodo) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaTodo{}
)

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

	return true
}

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

// FillFrom fills InputMediaTodo from given interface.
func ( *InputMediaTodo) ( interface {
	() ( TodoList)
}) {
	.Todo = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaTodo) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaTodo",
		ID:   InputMediaTodoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Todo",
			SchemaName: "todo",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputMediaTodo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaTodo#9fc55fde as nil")
	}
	.PutID(InputMediaTodoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaTodo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaTodo#9fc55fde as nil")
	}
	if  := .Todo.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaTodo#9fc55fde: field todo: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaTodo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaTodo#9fc55fde to nil")
	}
	{
		if  := .Todo.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaTodo#9fc55fde: field todo: %w", )
		}
	}
	return nil
}

// GetTodo returns value of Todo field.
func ( *InputMediaTodo) () ( TodoList) {
	if  == nil {
		return
	}
	return .Todo
}

// InputMediaStakeDice represents TL type `inputMediaStakeDice#f3a9244a`.
//
// See https://core.telegram.org/constructor/inputMediaStakeDice for reference.
type InputMediaStakeDice struct {
	// GameHash field of InputMediaStakeDice.
	GameHash string
	// TonAmount field of InputMediaStakeDice.
	TonAmount int64
	// ClientSeed field of InputMediaStakeDice.
	ClientSeed []byte
}

// InputMediaStakeDiceTypeID is TL type id of InputMediaStakeDice.
const InputMediaStakeDiceTypeID = 0xf3a9244a

// construct implements constructor of InputMediaClass.
func ( InputMediaStakeDice) () InputMediaClass { return & }

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

	_ InputMediaClass = &InputMediaStakeDice{}
)

func ( *InputMediaStakeDice) () bool {
	if  == nil {
		return true
	}
	if !(.GameHash == "") {
		return false
	}
	if !(.TonAmount == 0) {
		return false
	}
	if !(.ClientSeed == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputMediaStakeDice from given interface.
func ( *InputMediaStakeDice) ( interface {
	() ( string)
	() ( int64)
	() ( []byte)
}) {
	.GameHash = .()
	.TonAmount = .()
	.ClientSeed = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputMediaStakeDice) () tdp.Type {
	 := tdp.Type{
		Name: "inputMediaStakeDice",
		ID:   InputMediaStakeDiceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GameHash",
			SchemaName: "game_hash",
		},
		{
			Name:       "TonAmount",
			SchemaName: "ton_amount",
		},
		{
			Name:       "ClientSeed",
			SchemaName: "client_seed",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputMediaStakeDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaStakeDice#f3a9244a as nil")
	}
	.PutID(InputMediaStakeDiceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaStakeDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaStakeDice#f3a9244a as nil")
	}
	.PutString(.GameHash)
	.PutLong(.TonAmount)
	.PutBytes(.ClientSeed)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaStakeDice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaStakeDice#f3a9244a to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field game_hash: %w", )
		}
		.GameHash = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field ton_amount: %w", )
		}
		.TonAmount = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaStakeDice#f3a9244a: field client_seed: %w", )
		}
		.ClientSeed = 
	}
	return nil
}

// GetGameHash returns value of GameHash field.
func ( *InputMediaStakeDice) () ( string) {
	if  == nil {
		return
	}
	return .GameHash
}

// GetTonAmount returns value of TonAmount field.
func ( *InputMediaStakeDice) () ( int64) {
	if  == nil {
		return
	}
	return .TonAmount
}

// GetClientSeed returns value of ClientSeed field.
func ( *InputMediaStakeDice) () ( []byte) {
	if  == nil {
		return
	}
	return .ClientSeed
}

// InputMediaClassName is schema name of InputMediaClass.
const InputMediaClassName = "InputMedia"

// InputMediaClass represents InputMedia generic type.
//
// See https://core.telegram.org/type/InputMedia for reference.
//
// Constructors:
//   - [InputMediaEmpty]
//   - [InputMediaUploadedPhoto]
//   - [InputMediaPhoto]
//   - [InputMediaGeoPoint]
//   - [InputMediaContact]
//   - [InputMediaUploadedDocument]
//   - [InputMediaDocument]
//   - [InputMediaVenue]
//   - [InputMediaPhotoExternal]
//   - [InputMediaDocumentExternal]
//   - [InputMediaGame]
//   - [InputMediaInvoice]
//   - [InputMediaGeoLive]
//   - [InputMediaPoll]
//   - [InputMediaDice]
//   - [InputMediaStory]
//   - [InputMediaWebPage]
//   - [InputMediaPaidMedia]
//   - [InputMediaTodo]
//   - [InputMediaStakeDice]
//
// Example:
//
//	g, err := tg.DecodeInputMedia(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputMediaEmpty: // inputMediaEmpty#9664f57f
//	case *tg.InputMediaUploadedPhoto: // inputMediaUploadedPhoto#7d8375da
//	case *tg.InputMediaPhoto: // inputMediaPhoto#e3af4434
//	case *tg.InputMediaGeoPoint: // inputMediaGeoPoint#f9c44144
//	case *tg.InputMediaContact: // inputMediaContact#f8ab7dfb
//	case *tg.InputMediaUploadedDocument: // inputMediaUploadedDocument#37c9330
//	case *tg.InputMediaDocument: // inputMediaDocument#a8763ab5
//	case *tg.InputMediaVenue: // inputMediaVenue#c13d1c11
//	case *tg.InputMediaPhotoExternal: // inputMediaPhotoExternal#e5bbfe1a
//	case *tg.InputMediaDocumentExternal: // inputMediaDocumentExternal#779600f9
//	case *tg.InputMediaGame: // inputMediaGame#d33f43f3
//	case *tg.InputMediaInvoice: // inputMediaInvoice#405fef0d
//	case *tg.InputMediaGeoLive: // inputMediaGeoLive#971fa843
//	case *tg.InputMediaPoll: // inputMediaPoll#883a4108
//	case *tg.InputMediaDice: // inputMediaDice#e66fbf7b
//	case *tg.InputMediaStory: // inputMediaStory#89fdd778
//	case *tg.InputMediaWebPage: // inputMediaWebPage#c21b8849
//	case *tg.InputMediaPaidMedia: // inputMediaPaidMedia#c4103386
//	case *tg.InputMediaTodo: // inputMediaTodo#9fc55fde
//	case *tg.InputMediaStakeDice: // inputMediaStakeDice#f3a9244a
//	default: panic(v)
//	}
type InputMediaClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputMediaClass

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

// DecodeInputMedia implements binary de-serialization for InputMediaClass.
func ( *bin.Buffer) (InputMediaClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputMediaEmptyTypeID:
		// Decoding inputMediaEmpty#9664f57f.
		 := InputMediaEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaUploadedPhotoTypeID:
		// Decoding inputMediaUploadedPhoto#7d8375da.
		 := InputMediaUploadedPhoto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaPhotoTypeID:
		// Decoding inputMediaPhoto#e3af4434.
		 := InputMediaPhoto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaGeoPointTypeID:
		// Decoding inputMediaGeoPoint#f9c44144.
		 := InputMediaGeoPoint{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaContactTypeID:
		// Decoding inputMediaContact#f8ab7dfb.
		 := InputMediaContact{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaUploadedDocumentTypeID:
		// Decoding inputMediaUploadedDocument#37c9330.
		 := InputMediaUploadedDocument{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaDocumentTypeID:
		// Decoding inputMediaDocument#a8763ab5.
		 := InputMediaDocument{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaVenueTypeID:
		// Decoding inputMediaVenue#c13d1c11.
		 := InputMediaVenue{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaPhotoExternalTypeID:
		// Decoding inputMediaPhotoExternal#e5bbfe1a.
		 := InputMediaPhotoExternal{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaDocumentExternalTypeID:
		// Decoding inputMediaDocumentExternal#779600f9.
		 := InputMediaDocumentExternal{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaGameTypeID:
		// Decoding inputMediaGame#d33f43f3.
		 := InputMediaGame{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaInvoiceTypeID:
		// Decoding inputMediaInvoice#405fef0d.
		 := InputMediaInvoice{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaGeoLiveTypeID:
		// Decoding inputMediaGeoLive#971fa843.
		 := InputMediaGeoLive{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaPollTypeID:
		// Decoding inputMediaPoll#883a4108.
		 := InputMediaPoll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaDiceTypeID:
		// Decoding inputMediaDice#e66fbf7b.
		 := InputMediaDice{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaStoryTypeID:
		// Decoding inputMediaStory#89fdd778.
		 := InputMediaStory{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaWebPageTypeID:
		// Decoding inputMediaWebPage#c21b8849.
		 := InputMediaWebPage{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaPaidMediaTypeID:
		// Decoding inputMediaPaidMedia#c4103386.
		 := InputMediaPaidMedia{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaTodoTypeID:
		// Decoding inputMediaTodo#9fc55fde.
		 := InputMediaTodo{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaStakeDiceTypeID:
		// Decoding inputMediaStakeDice#f3a9244a.
		 := InputMediaStakeDice{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputMediaClass: %w", bin.NewUnexpectedID())
	}
}

// InputMedia boxes the InputMediaClass providing a helper.
type InputMediaBox struct {
	InputMedia InputMediaClass
}

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

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