// 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#1e287d04`.
// 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
	// 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
}

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

// 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 !(.File == nil) {
		return false
	}
	if !(.Stickers == nil) {
		return false
	}
	if !(.TTLSeconds == 0) {
		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)
	() ( InputFileClass)
	() ( []InputDocumentClass,  bool)
	() ( int,  bool)
}) {
	.Spoiler = .()
	.File = .()
	if ,  := .();  {
		.Stickers = 
	}

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

}

// 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:       "File",
			SchemaName: "file",
		},
		{
			Name:       "Stickers",
			SchemaName: "stickers",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

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

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

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

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

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

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

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

// 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#b3ba0635`.
// 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
	// Photo to be forwarded
	ID InputPhotoClass
	// Time to live in seconds of self-destructing photo
	//
	// Use SetTTLSeconds and GetTTLSeconds helpers.
	TTLSeconds int
}

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

// 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 !(.ID == nil) {
		return false
	}
	if !(.TTLSeconds == 0) {
		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)
	() ( InputPhotoClass)
	() ( int,  bool)
}) {
	.Spoiler = .()
	.ID = .()
	if ,  := .();  {
		.TTLSeconds = 
	}

}

// 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:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "TTLSeconds",
			SchemaName: "ttl_seconds",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

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

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

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

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaPhoto#b3ba0635 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(1)
	{
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaPhoto#b3ba0635: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	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)
}

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

// 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#5b38c6c1`.
// 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 the specified document is a video file with no audio tracks (a GIF animation
	// (even as MPEG4), for example)
	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
	// 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 = 0x5b38c6c1

// 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 !(.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)
	() ( int,  bool)
}) {
	.NosoundVideo = .()
	.ForceFile = .()
	.Spoiler = .()
	.File = .()
	if ,  := .();  {
		.Thumb = 
	}

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

	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:       "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 !(.TTLSeconds == 0) {
		.Flags.Set(1)
	}
}

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

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaUploadedDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaUploadedDocument#5b38c6c1 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field flags: %w", )
	}
	if .File == nil {
		return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field file is nil")
	}
	if  := .File.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field file: %w", )
	}
	if .Flags.Has(2) {
		if .Thumb == nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field thumb is nil")
		}
		if  := .Thumb.Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field thumb: %w", )
		}
	}
	.PutString(.MimeType)
	.PutVectorHeader(len(.Attributes))
	for ,  := range .Attributes {
		if  == nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field attributes element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: 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#5b38c6c1: field stickers element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode inputMediaUploadedDocument#5b38c6c1: field stickers element with index %d: %w", , )
			}
		}
	}
	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#5b38c6c1 to nil")
	}
	if  := .ConsumeID(InputMediaUploadedDocumentTypeID);  != nil {
		return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaUploadedDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaUploadedDocument#5b38c6c1 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: 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#5b38c6c1: field file: %w", )
		}
		.File = 
	}
	if .Flags.Has(2) {
		,  := DecodeInputFile()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: field thumb: %w", )
		}
		.Thumb = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: field mime_type: %w", )
		}
		.MimeType = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: field attributes: %w", )
		}

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

		if  > 0 {
			.Stickers = make([]InputDocumentClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputDocument()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: field stickers: %w", )
			}
			.Stickers = append(.Stickers, )
		}
	}
	if .Flags.Has(1) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaUploadedDocument#5b38c6c1: 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
}

// 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#33473058`.
// 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
	// 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 = 0x33473058

// 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 !(.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)
	() ( int,  bool)
	() ( string,  bool)
}) {
	.Spoiler = .()
	.ID = .()
	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:       "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 !(.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#33473058 as nil")
	}
	.PutID(InputMediaDocumentTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaDocument#33473058 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaDocument#33473058: field flags: %w", )
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode inputMediaDocument#33473058: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaDocument#33473058: field id: %w", )
	}
	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#33473058 to nil")
	}
	if  := .ConsumeID(InputMediaDocumentTypeID);  != nil {
		return fmt.Errorf("unable to decode inputMediaDocument#33473058: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaDocument#33473058 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#33473058: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(2)
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#33473058: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#33473058: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocument#33473058: 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
}

// 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#fb52dc99`.
// 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
}

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

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

	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)
}) {
	.Spoiler = .()
	.URL = .()
	if ,  := .();  {
		.TTLSeconds = 
	}

}

// 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),
		},
	}
	return 
}

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

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

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

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

// DecodeBare implements bin.BareDecoder.
func ( *InputMediaDocumentExternal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputMediaDocumentExternal#fb52dc99 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#fb52dc99: field flags: %w", )
		}
	}
	.Spoiler = .Flags.Has(1)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#fb52dc99: field url: %w", )
		}
		.URL = 
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputMediaDocumentExternal#fb52dc99: field ttl_seconds: %w", )
		}
		.TTLSeconds = 
	}
	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
}

// 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#8eb5a6d5`.
// 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
	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
	// Extended media
	//
	// Use SetExtendedMedia and GetExtendedMedia helpers.
	ExtendedMedia InputMediaClass
}

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

// 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)
	() ( DataJSON)
	() ( string,  bool)
	() ( InputMediaClass,  bool)
}) {
	.Title = .()
	.Description = .()
	if ,  := .();  {
		.Photo = 
	}

	.Invoice = .()
	.Payload = .()
	.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",
		},
		{
			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 !(.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#8eb5a6d5 as nil")
	}
	.PutID(InputMediaInvoiceTypeID)
	return .EncodeBare()
}

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

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

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

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

// 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#f94e5f1`.
// 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 [][]byte
	// 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
}

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

// 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 !(.Solution == "") {
		return false
	}
	if !(.SolutionEntities == 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)
	() ( [][]byte,  bool)
	() ( string,  bool)
	() ( []MessageEntityClass,  bool)
}) {
	.Poll = .()
	if ,  := .();  {
		.CorrectAnswers = 
	}

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

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

}

// 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:       "Solution",
			SchemaName: "solution",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "SolutionEntities",
			SchemaName: "solution_entities",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

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

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

// EncodeBare implements bin.BareEncoder.
func ( *InputMediaPoll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputMediaPoll#f94e5f1 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field flags: %w", )
	}
	if  := .Poll.Encode();  != nil {
		return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field poll: %w", )
	}
	if .Flags.Has(0) {
		.PutVectorHeader(len(.CorrectAnswers))
		for ,  := range .CorrectAnswers {
			.PutBytes()
		}
	}
	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#f94e5f1: field solution_entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode inputMediaPoll#f94e5f1: field solution_entities element with index %d: %w", , )
			}
		}
	}
	return nil
}

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

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

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

		if  > 0 {
			.SolutionEntities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode inputMediaPoll#f94e5f1: field solution_entities: %w", )
			}
			.SolutionEntities = append(.SolutionEntities, )
		}
	}
	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) ( [][]byte) {
	.Flags.Set(0)
	.CorrectAnswers = 
}

// GetCorrectAnswers returns value of CorrectAnswers conditional field and
// boolean which is true if field was set.
func ( *InputMediaPoll) () ( [][]byte,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .CorrectAnswers, 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
}

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

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

// InputMediaClass represents InputMedia generic type.
//
// See https://core.telegram.org/type/InputMedia for reference.
//
// Example:
//
//	g, err := tg.DecodeInputMedia(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputMediaEmpty: // inputMediaEmpty#9664f57f
//	case *tg.InputMediaUploadedPhoto: // inputMediaUploadedPhoto#1e287d04
//	case *tg.InputMediaPhoto: // inputMediaPhoto#b3ba0635
//	case *tg.InputMediaGeoPoint: // inputMediaGeoPoint#f9c44144
//	case *tg.InputMediaContact: // inputMediaContact#f8ab7dfb
//	case *tg.InputMediaUploadedDocument: // inputMediaUploadedDocument#5b38c6c1
//	case *tg.InputMediaDocument: // inputMediaDocument#33473058
//	case *tg.InputMediaVenue: // inputMediaVenue#c13d1c11
//	case *tg.InputMediaPhotoExternal: // inputMediaPhotoExternal#e5bbfe1a
//	case *tg.InputMediaDocumentExternal: // inputMediaDocumentExternal#fb52dc99
//	case *tg.InputMediaGame: // inputMediaGame#d33f43f3
//	case *tg.InputMediaInvoice: // inputMediaInvoice#8eb5a6d5
//	case *tg.InputMediaGeoLive: // inputMediaGeoLive#971fa843
//	case *tg.InputMediaPoll: // inputMediaPoll#f94e5f1
//	case *tg.InputMediaDice: // inputMediaDice#e66fbf7b
//	case *tg.InputMediaStory: // inputMediaStory#89fdd778
//	case *tg.InputMediaWebPage: // inputMediaWebPage#c21b8849
//	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#1e287d04.
		 := InputMediaUploadedPhoto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaPhotoTypeID:
		// Decoding inputMediaPhoto#b3ba0635.
		 := 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#5b38c6c1.
		 := InputMediaUploadedDocument{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputMediaClass: %w", )
		}
		return &, nil
	case InputMediaDocumentTypeID:
		// Decoding inputMediaDocument#33473058.
		 := 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#fb52dc99.
		 := 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#8eb5a6d5.
		 := 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#f94e5f1.
		 := 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
	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()
}