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

// BotInlineMessageMediaAuto represents TL type `botInlineMessageMediaAuto#764cf810`.
// Send whatever media is attached to the botInlineMediaResult¹
//
// Links:
//  1. https://core.telegram.org/constructor/botInlineMediaResult
//
// See https://core.telegram.org/constructor/botInlineMessageMediaAuto for reference.
type BotInlineMessageMediaAuto struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, any eventual webpage preview will be shown on top of the message instead of at
	// the bottom.
	InvertMedia bool
	// Caption
	Message string
	// Message entities for styled text¹
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	//
	// Use SetEntities and GetEntities helpers.
	Entities []MessageEntityClass
	// Inline keyboard
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageMediaAutoTypeID is TL type id of BotInlineMessageMediaAuto.
const BotInlineMessageMediaAutoTypeID = 0x764cf810

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageMediaAuto) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageMediaAuto{}
)

func ( *BotInlineMessageMediaAuto) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.InvertMedia == false) {
		return false
	}
	if !(.Message == "") {
		return false
	}
	if !(.Entities == nil) {
		return false
	}
	if !(.ReplyMarkup == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotInlineMessageMediaAuto from given interface.
func ( *BotInlineMessageMediaAuto) ( interface {
	() ( bool)
	() ( string)
	() ( []MessageEntityClass,  bool)
	() ( ReplyMarkupClass,  bool)
}) {
	.InvertMedia = .()
	.Message = .()
	if ,  := .();  {
		.Entities = 
	}

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

}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMessageMediaAuto) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMessageMediaAuto",
		ID:   BotInlineMessageMediaAutoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "InvertMedia",
			SchemaName: "invert_media",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
		{
			Name:       "Entities",
			SchemaName: "entities",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineMessageMediaAuto) () {
	if !(.InvertMedia == false) {
		.Flags.Set(3)
	}
	if !(.Entities == nil) {
		.Flags.Set(1)
	}
	if !(.ReplyMarkup == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineMessageMediaAuto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaAuto#764cf810 as nil")
	}
	.PutID(BotInlineMessageMediaAutoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMessageMediaAuto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaAuto#764cf810 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaAuto#764cf810: field flags: %w", )
	}
	.PutString(.Message)
	if .Flags.Has(1) {
		.PutVectorHeader(len(.Entities))
		for ,  := range .Entities {
			if  == nil {
				return fmt.Errorf("unable to encode botInlineMessageMediaAuto#764cf810: field entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode botInlineMessageMediaAuto#764cf810: field entities element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaAuto#764cf810: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaAuto#764cf810: field reply_markup: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMessageMediaAuto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMessageMediaAuto#764cf810 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaAuto#764cf810: field flags: %w", )
		}
	}
	.InvertMedia = .Flags.Has(3)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaAuto#764cf810: field message: %w", )
		}
		.Message = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaAuto#764cf810: field entities: %w", )
		}

		if  > 0 {
			.Entities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode botInlineMessageMediaAuto#764cf810: field entities: %w", )
			}
			.Entities = append(.Entities, )
		}
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaAuto#764cf810: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	return nil
}

// SetInvertMedia sets value of InvertMedia conditional field.
func ( *BotInlineMessageMediaAuto) ( bool) {
	if  {
		.Flags.Set(3)
		.InvertMedia = true
	} else {
		.Flags.Unset(3)
		.InvertMedia = false
	}
}

// GetInvertMedia returns value of InvertMedia conditional field.
func ( *BotInlineMessageMediaAuto) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

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

// SetEntities sets value of Entities conditional field.
func ( *BotInlineMessageMediaAuto) ( []MessageEntityClass) {
	.Flags.Set(1)
	.Entities = 
}

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageMediaAuto) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageMediaAuto) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

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

// BotInlineMessageText represents TL type `botInlineMessageText#8c7f65e2`.
// Send a simple text message
//
// See https://core.telegram.org/constructor/botInlineMessageText for reference.
type BotInlineMessageText struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Disable webpage preview
	NoWebpage bool
	// If set, any eventual webpage preview will be shown on top of the message instead of at
	// the bottom.
	InvertMedia bool
	// The message
	Message string
	// Message entities for styled text¹
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	//
	// Use SetEntities and GetEntities helpers.
	Entities []MessageEntityClass
	// Inline keyboard
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageTextTypeID is TL type id of BotInlineMessageText.
const BotInlineMessageTextTypeID = 0x8c7f65e2

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageText) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageText{}
)

func ( *BotInlineMessageText) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.NoWebpage == false) {
		return false
	}
	if !(.InvertMedia == false) {
		return false
	}
	if !(.Message == "") {
		return false
	}
	if !(.Entities == nil) {
		return false
	}
	if !(.ReplyMarkup == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotInlineMessageText from given interface.
func ( *BotInlineMessageText) ( interface {
	() ( bool)
	() ( bool)
	() ( string)
	() ( []MessageEntityClass,  bool)
	() ( ReplyMarkupClass,  bool)
}) {
	.NoWebpage = .()
	.InvertMedia = .()
	.Message = .()
	if ,  := .();  {
		.Entities = 
	}

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

}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMessageText) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMessageText",
		ID:   BotInlineMessageTextTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "NoWebpage",
			SchemaName: "no_webpage",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "InvertMedia",
			SchemaName: "invert_media",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
		{
			Name:       "Entities",
			SchemaName: "entities",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineMessageText) () {
	if !(.NoWebpage == false) {
		.Flags.Set(0)
	}
	if !(.InvertMedia == false) {
		.Flags.Set(3)
	}
	if !(.Entities == nil) {
		.Flags.Set(1)
	}
	if !(.ReplyMarkup == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineMessageText) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageText#8c7f65e2 as nil")
	}
	.PutID(BotInlineMessageTextTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMessageText) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageText#8c7f65e2 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageText#8c7f65e2: field flags: %w", )
	}
	.PutString(.Message)
	if .Flags.Has(1) {
		.PutVectorHeader(len(.Entities))
		for ,  := range .Entities {
			if  == nil {
				return fmt.Errorf("unable to encode botInlineMessageText#8c7f65e2: field entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode botInlineMessageText#8c7f65e2: field entities element with index %d: %w", , )
			}
		}
	}
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode botInlineMessageText#8c7f65e2: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageText#8c7f65e2: field reply_markup: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMessageText) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMessageText#8c7f65e2 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMessageText#8c7f65e2: field flags: %w", )
		}
	}
	.NoWebpage = .Flags.Has(0)
	.InvertMedia = .Flags.Has(3)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageText#8c7f65e2: field message: %w", )
		}
		.Message = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageText#8c7f65e2: field entities: %w", )
		}

		if  > 0 {
			.Entities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode botInlineMessageText#8c7f65e2: field entities: %w", )
			}
			.Entities = append(.Entities, )
		}
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageText#8c7f65e2: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	return nil
}

// SetNoWebpage sets value of NoWebpage conditional field.
func ( *BotInlineMessageText) ( bool) {
	if  {
		.Flags.Set(0)
		.NoWebpage = true
	} else {
		.Flags.Unset(0)
		.NoWebpage = false
	}
}

// GetNoWebpage returns value of NoWebpage conditional field.
func ( *BotInlineMessageText) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetInvertMedia sets value of InvertMedia conditional field.
func ( *BotInlineMessageText) ( bool) {
	if  {
		.Flags.Set(3)
		.InvertMedia = true
	} else {
		.Flags.Unset(3)
		.InvertMedia = false
	}
}

// GetInvertMedia returns value of InvertMedia conditional field.
func ( *BotInlineMessageText) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

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

// SetEntities sets value of Entities conditional field.
func ( *BotInlineMessageText) ( []MessageEntityClass) {
	.Flags.Set(1)
	.Entities = 
}

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageText) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageText) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

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

// BotInlineMessageMediaGeo represents TL type `botInlineMessageMediaGeo#51846fd`.
// Send a geolocation
//
// See https://core.telegram.org/constructor/botInlineMessageMediaGeo for reference.
type BotInlineMessageMediaGeo struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Geolocation
	Geo GeoPointClass
	// For live locations¹, a direction in which the location moves, in degrees; 1-360.
	//
	// Links:
	//  1) https://core.telegram.org/api/live-location
	//
	// Use SetHeading and GetHeading helpers.
	Heading int
	// Validity period
	//
	// 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
	// Inline keyboard
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageMediaGeoTypeID is TL type id of BotInlineMessageMediaGeo.
const BotInlineMessageMediaGeoTypeID = 0x51846fd

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageMediaGeo) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageMediaGeo{}
)

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

	return true
}

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

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

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

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

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

}

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

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

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

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

// Encode implements bin.Encoder.
func ( *BotInlineMessageMediaGeo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaGeo#51846fd as nil")
	}
	.PutID(BotInlineMessageMediaGeoTypeID)
	return .EncodeBare()
}

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

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

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

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

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

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

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

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

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

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageMediaGeo) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageMediaGeo) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

// BotInlineMessageMediaVenue represents TL type `botInlineMessageMediaVenue#8a86659c`.
// Send a venue
//
// See https://core.telegram.org/constructor/botInlineMessageMediaVenue for reference.
type BotInlineMessageMediaVenue struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Geolocation of venue
	Geo GeoPointClass
	// Venue name
	Title string
	// Address
	Address string
	// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be
	// supported
	Provider string
	// Venue ID in the provider's database
	VenueID string
	// Venue type in the provider's database
	VenueType string
	// Inline keyboard
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageMediaVenueTypeID is TL type id of BotInlineMessageMediaVenue.
const BotInlineMessageMediaVenueTypeID = 0x8a86659c

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageMediaVenue) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageMediaVenue{}
)

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

	return true
}

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

// FillFrom fills BotInlineMessageMediaVenue from given interface.
func ( *BotInlineMessageMediaVenue) ( interface {
	() ( GeoPointClass)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( ReplyMarkupClass,  bool)
}) {
	.Geo = .()
	.Title = .()
	.Address = .()
	.Provider = .()
	.VenueID = .()
	.VenueType = .()
	if ,  := .();  {
		.ReplyMarkup = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMessageMediaVenue) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMessageMediaVenue",
		ID:   BotInlineMessageMediaVenueTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Geo",
			SchemaName: "geo",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Address",
			SchemaName: "address",
		},
		{
			Name:       "Provider",
			SchemaName: "provider",
		},
		{
			Name:       "VenueID",
			SchemaName: "venue_id",
		},
		{
			Name:       "VenueType",
			SchemaName: "venue_type",
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineMessageMediaVenue) () {
	if !(.ReplyMarkup == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineMessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaVenue#8a86659c as nil")
	}
	.PutID(BotInlineMessageMediaVenueTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaVenue#8a86659c as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaVenue#8a86659c: field flags: %w", )
	}
	if .Geo == nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaVenue#8a86659c: field geo is nil")
	}
	if  := .Geo.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaVenue#8a86659c: field geo: %w", )
	}
	.PutString(.Title)
	.PutString(.Address)
	.PutString(.Provider)
	.PutString(.VenueID)
	.PutString(.VenueType)
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaVenue#8a86659c: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaVenue#8a86659c: field reply_markup: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMessageMediaVenue) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMessageMediaVenue#8a86659c to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field flags: %w", )
		}
	}
	{
		,  := DecodeGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field geo: %w", )
		}
		.Geo = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field address: %w", )
		}
		.Address = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field provider: %w", )
		}
		.Provider = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field venue_id: %w", )
		}
		.VenueID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field venue_type: %w", )
		}
		.VenueType = 
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaVenue#8a86659c: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	return nil
}

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

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

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

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

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

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageMediaVenue) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageMediaVenue) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

// BotInlineMessageMediaContact represents TL type `botInlineMessageMediaContact#18d1cdc2`.
// Send a contact
//
// See https://core.telegram.org/constructor/botInlineMessageMediaContact for reference.
type BotInlineMessageMediaContact struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Phone number
	PhoneNumber string
	// First name
	FirstName string
	// Last name
	LastName string
	// VCard info
	Vcard string
	// Inline keyboard
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageMediaContactTypeID is TL type id of BotInlineMessageMediaContact.
const BotInlineMessageMediaContactTypeID = 0x18d1cdc2

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageMediaContact) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageMediaContact{}
)

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

	return true
}

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

// FillFrom fills BotInlineMessageMediaContact from given interface.
func ( *BotInlineMessageMediaContact) ( interface {
	() ( string)
	() ( string)
	() ( string)
	() ( string)
	() ( ReplyMarkupClass,  bool)
}) {
	.PhoneNumber = .()
	.FirstName = .()
	.LastName = .()
	.Vcard = .()
	if ,  := .();  {
		.ReplyMarkup = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMessageMediaContact) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMessageMediaContact",
		ID:   BotInlineMessageMediaContactTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "FirstName",
			SchemaName: "first_name",
		},
		{
			Name:       "LastName",
			SchemaName: "last_name",
		},
		{
			Name:       "Vcard",
			SchemaName: "vcard",
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineMessageMediaContact) () {
	if !(.ReplyMarkup == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineMessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaContact#18d1cdc2 as nil")
	}
	.PutID(BotInlineMessageMediaContactTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaContact#18d1cdc2 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaContact#18d1cdc2: field flags: %w", )
	}
	.PutString(.PhoneNumber)
	.PutString(.FirstName)
	.PutString(.LastName)
	.PutString(.Vcard)
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaContact#18d1cdc2: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaContact#18d1cdc2: field reply_markup: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMessageMediaContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMessageMediaContact#18d1cdc2 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaContact#18d1cdc2: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaContact#18d1cdc2: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaContact#18d1cdc2: field first_name: %w", )
		}
		.FirstName = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaContact#18d1cdc2: field last_name: %w", )
		}
		.LastName = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaContact#18d1cdc2: field vcard: %w", )
		}
		.Vcard = 
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaContact#18d1cdc2: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	return nil
}

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

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

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

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageMediaContact) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageMediaContact) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

// BotInlineMessageMediaInvoice represents TL type `botInlineMessageMediaInvoice#354a9b09`.
// Send an invoice
//
// See https://core.telegram.org/constructor/botInlineMessageMediaInvoice for reference.
type BotInlineMessageMediaInvoice struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Set this flag if you require the user's shipping address to complete the order
	ShippingAddressRequested bool
	// Test invoice
	Test bool
	// Product name, 1-32 characters
	Title string
	// Product description, 1-255 characters
	Description string
	// Product photo
	//
	// Use SetPhoto and GetPhoto helpers.
	Photo WebDocumentClass
	// Three-letter ISO 4217 currency¹ code
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments#supported-currencies
	Currency string
	// Total price in the smallest units of the currency (integer, not float/double). For
	// example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in
	// currencies.json¹, it shows the number of digits past the decimal point for each
	// currency (2 for the majority of currencies).
	//
	// Links:
	//  1) https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int64
	// Inline keyboard
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageMediaInvoiceTypeID is TL type id of BotInlineMessageMediaInvoice.
const BotInlineMessageMediaInvoiceTypeID = 0x354a9b09

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageMediaInvoice) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageMediaInvoice{}
)

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

	return true
}

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

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMessageMediaInvoice) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMessageMediaInvoice",
		ID:   BotInlineMessageMediaInvoiceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ShippingAddressRequested",
			SchemaName: "shipping_address_requested",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Test",
			SchemaName: "test",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Description",
			SchemaName: "description",
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Currency",
			SchemaName: "currency",
		},
		{
			Name:       "TotalAmount",
			SchemaName: "total_amount",
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *BotInlineMessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaInvoice#354a9b09 as nil")
	}
	.PutID(BotInlineMessageMediaInvoiceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaInvoice#354a9b09 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaInvoice#354a9b09: field flags: %w", )
	}
	.PutString(.Title)
	.PutString(.Description)
	if .Flags.Has(0) {
		if .Photo == nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaInvoice#354a9b09: field photo is nil")
		}
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaInvoice#354a9b09: field photo: %w", )
		}
	}
	.PutString(.Currency)
	.PutLong(.TotalAmount)
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaInvoice#354a9b09: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaInvoice#354a9b09: field reply_markup: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMessageMediaInvoice) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMessageMediaInvoice#354a9b09 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field flags: %w", )
		}
	}
	.ShippingAddressRequested = .Flags.Has(1)
	.Test = .Flags.Has(3)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field description: %w", )
		}
		.Description = 
	}
	if .Flags.Has(0) {
		,  := DecodeWebDocument()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field photo: %w", )
		}
		.Photo = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field currency: %w", )
		}
		.Currency = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field total_amount: %w", )
		}
		.TotalAmount = 
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaInvoice#354a9b09: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	return nil
}

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

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

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

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

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

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

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

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

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

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageMediaInvoice) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageMediaInvoice) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

// BotInlineMessageMediaWebPage represents TL type `botInlineMessageMediaWebPage#809ad9a6`.
// Specifies options that must be used to generate the link preview for the message, or
// even a standalone link preview without an attached message.
//
// See https://core.telegram.org/constructor/botInlineMessageMediaWebPage for reference.
type BotInlineMessageMediaWebPage struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, any eventual webpage preview will be shown on top of the message instead of at
	// the bottom.
	InvertMedia bool
	// If set, specifies that a large media preview should be used.
	ForceLargeMedia bool
	// If set, specifies that a small media preview should be used.
	ForceSmallMedia bool
	// If set, indicates that the URL used for the webpage preview was specified manually
	// using inputMediaWebPage¹, and may not be related to any of the URLs specified in the
	// message.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputMediaWebPage
	Manual bool
	// If set, the link can be opened directly without user confirmation.
	Safe bool
	// The message, can be empty.
	Message string
	// Message entities for styled text¹
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	//
	// Use SetEntities and GetEntities helpers.
	Entities []MessageEntityClass
	// The URL to use for the link preview.
	URL string
	// Reply markup for sending bot buttons
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
}

// BotInlineMessageMediaWebPageTypeID is TL type id of BotInlineMessageMediaWebPage.
const BotInlineMessageMediaWebPageTypeID = 0x809ad9a6

// construct implements constructor of BotInlineMessageClass.
func ( BotInlineMessageMediaWebPage) () BotInlineMessageClass { return & }

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

	_ BotInlineMessageClass = &BotInlineMessageMediaWebPage{}
)

func ( *BotInlineMessageMediaWebPage) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.InvertMedia == false) {
		return false
	}
	if !(.ForceLargeMedia == false) {
		return false
	}
	if !(.ForceSmallMedia == false) {
		return false
	}
	if !(.Manual == false) {
		return false
	}
	if !(.Safe == false) {
		return false
	}
	if !(.Message == "") {
		return false
	}
	if !(.Entities == nil) {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.ReplyMarkup == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotInlineMessageMediaWebPage from given interface.
func ( *BotInlineMessageMediaWebPage) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( string)
	() ( []MessageEntityClass,  bool)
	() ( string)
	() ( ReplyMarkupClass,  bool)
}) {
	.InvertMedia = .()
	.ForceLargeMedia = .()
	.ForceSmallMedia = .()
	.Manual = .()
	.Safe = .()
	.Message = .()
	if ,  := .();  {
		.Entities = 
	}

	.URL = .()
	if ,  := .();  {
		.ReplyMarkup = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMessageMediaWebPage) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMessageMediaWebPage",
		ID:   BotInlineMessageMediaWebPageTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "InvertMedia",
			SchemaName: "invert_media",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "ForceLargeMedia",
			SchemaName: "force_large_media",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "ForceSmallMedia",
			SchemaName: "force_small_media",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Manual",
			SchemaName: "manual",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "Safe",
			SchemaName: "safe",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "Message",
			SchemaName: "message",
		},
		{
			Name:       "Entities",
			SchemaName: "entities",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineMessageMediaWebPage) () {
	if !(.InvertMedia == false) {
		.Flags.Set(3)
	}
	if !(.ForceLargeMedia == false) {
		.Flags.Set(4)
	}
	if !(.ForceSmallMedia == false) {
		.Flags.Set(5)
	}
	if !(.Manual == false) {
		.Flags.Set(7)
	}
	if !(.Safe == false) {
		.Flags.Set(8)
	}
	if !(.Entities == nil) {
		.Flags.Set(1)
	}
	if !(.ReplyMarkup == nil) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineMessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaWebPage#809ad9a6 as nil")
	}
	.PutID(BotInlineMessageMediaWebPageTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMessageMediaWebPage#809ad9a6 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMessageMediaWebPage#809ad9a6: field flags: %w", )
	}
	.PutString(.Message)
	if .Flags.Has(1) {
		.PutVectorHeader(len(.Entities))
		for ,  := range .Entities {
			if  == nil {
				return fmt.Errorf("unable to encode botInlineMessageMediaWebPage#809ad9a6: field entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode botInlineMessageMediaWebPage#809ad9a6: field entities element with index %d: %w", , )
			}
		}
	}
	.PutString(.URL)
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaWebPage#809ad9a6: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMessageMediaWebPage#809ad9a6: field reply_markup: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMessageMediaWebPage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMessageMediaWebPage#809ad9a6 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaWebPage#809ad9a6: field flags: %w", )
		}
	}
	.InvertMedia = .Flags.Has(3)
	.ForceLargeMedia = .Flags.Has(4)
	.ForceSmallMedia = .Flags.Has(5)
	.Manual = .Flags.Has(7)
	.Safe = .Flags.Has(8)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaWebPage#809ad9a6: field message: %w", )
		}
		.Message = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaWebPage#809ad9a6: field entities: %w", )
		}

		if  > 0 {
			.Entities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode botInlineMessageMediaWebPage#809ad9a6: field entities: %w", )
			}
			.Entities = append(.Entities, )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaWebPage#809ad9a6: field url: %w", )
		}
		.URL = 
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMessageMediaWebPage#809ad9a6: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	return nil
}

// SetInvertMedia sets value of InvertMedia conditional field.
func ( *BotInlineMessageMediaWebPage) ( bool) {
	if  {
		.Flags.Set(3)
		.InvertMedia = true
	} else {
		.Flags.Unset(3)
		.InvertMedia = false
	}
}

// GetInvertMedia returns value of InvertMedia conditional field.
func ( *BotInlineMessageMediaWebPage) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

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

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

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

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

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

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

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

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

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

// SetEntities sets value of Entities conditional field.
func ( *BotInlineMessageMediaWebPage) ( []MessageEntityClass) {
	.Flags.Set(1)
	.Entities = 
}

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

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

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *BotInlineMessageMediaWebPage) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *BotInlineMessageMediaWebPage) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

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

// BotInlineMessageClassName is schema name of BotInlineMessageClass.
const BotInlineMessageClassName = "BotInlineMessage"

// BotInlineMessageClass represents BotInlineMessage generic type.
//
// See https://core.telegram.org/type/BotInlineMessage for reference.
//
// Example:
//
//	g, err := tg.DecodeBotInlineMessage(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.BotInlineMessageMediaAuto: // botInlineMessageMediaAuto#764cf810
//	case *tg.BotInlineMessageText: // botInlineMessageText#8c7f65e2
//	case *tg.BotInlineMessageMediaGeo: // botInlineMessageMediaGeo#51846fd
//	case *tg.BotInlineMessageMediaVenue: // botInlineMessageMediaVenue#8a86659c
//	case *tg.BotInlineMessageMediaContact: // botInlineMessageMediaContact#18d1cdc2
//	case *tg.BotInlineMessageMediaInvoice: // botInlineMessageMediaInvoice#354a9b09
//	case *tg.BotInlineMessageMediaWebPage: // botInlineMessageMediaWebPage#809ad9a6
//	default: panic(v)
//	}
type BotInlineMessageClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() BotInlineMessageClass

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

	// Inline keyboard
	GetReplyMarkup() (value ReplyMarkupClass, ok bool)
}

// DecodeBotInlineMessage implements binary de-serialization for BotInlineMessageClass.
func ( *bin.Buffer) (BotInlineMessageClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case BotInlineMessageMediaAutoTypeID:
		// Decoding botInlineMessageMediaAuto#764cf810.
		 := BotInlineMessageMediaAuto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	case BotInlineMessageTextTypeID:
		// Decoding botInlineMessageText#8c7f65e2.
		 := BotInlineMessageText{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	case BotInlineMessageMediaGeoTypeID:
		// Decoding botInlineMessageMediaGeo#51846fd.
		 := BotInlineMessageMediaGeo{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	case BotInlineMessageMediaVenueTypeID:
		// Decoding botInlineMessageMediaVenue#8a86659c.
		 := BotInlineMessageMediaVenue{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	case BotInlineMessageMediaContactTypeID:
		// Decoding botInlineMessageMediaContact#18d1cdc2.
		 := BotInlineMessageMediaContact{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	case BotInlineMessageMediaInvoiceTypeID:
		// Decoding botInlineMessageMediaInvoice#354a9b09.
		 := BotInlineMessageMediaInvoice{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	case BotInlineMessageMediaWebPageTypeID:
		// Decoding botInlineMessageMediaWebPage#809ad9a6.
		 := BotInlineMessageMediaWebPage{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode BotInlineMessageClass: %w", bin.NewUnexpectedID())
	}
}

// BotInlineMessage boxes the BotInlineMessageClass providing a helper.
type BotInlineMessageBox struct {
	BotInlineMessage BotInlineMessageClass
}

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

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