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

// ExportedMessageLink represents TL type `exportedMessageLink#5dab1af4`.
// Link to a message in a supergroup/channel
//
// See https://core.telegram.org/constructor/exportedMessageLink for reference.
type ExportedMessageLink struct {
	// URL
	Link string
	// Embed code
	HTML string
}

// ExportedMessageLinkTypeID is TL type id of ExportedMessageLink.
const ExportedMessageLinkTypeID = 0x5dab1af4

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

func ( *ExportedMessageLink) () bool {
	if  == nil {
		return true
	}
	if !(.Link == "") {
		return false
	}
	if !(.HTML == "") {
		return false
	}

	return true
}

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

// FillFrom fills ExportedMessageLink from given interface.
func ( *ExportedMessageLink) ( interface {
	() ( string)
	() ( string)
}) {
	.Link = .()
	.HTML = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ExportedMessageLink) () tdp.Type {
	 := tdp.Type{
		Name: "exportedMessageLink",
		ID:   ExportedMessageLinkTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Link",
			SchemaName: "link",
		},
		{
			Name:       "HTML",
			SchemaName: "html",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ExportedMessageLink) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode exportedMessageLink#5dab1af4 as nil")
	}
	.PutID(ExportedMessageLinkTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ExportedMessageLink) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode exportedMessageLink#5dab1af4 as nil")
	}
	.PutString(.Link)
	.PutString(.HTML)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ExportedMessageLink) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode exportedMessageLink#5dab1af4 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode exportedMessageLink#5dab1af4: field link: %w", )
		}
		.Link = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode exportedMessageLink#5dab1af4: field html: %w", )
		}
		.HTML = 
	}
	return nil
}

// GetLink returns value of Link field.
func ( *ExportedMessageLink) () ( string) {
	if  == nil {
		return
	}
	return .Link
}

// GetHTML returns value of HTML field.
func ( *ExportedMessageLink) () ( string) {
	if  == nil {
		return
	}
	return .HTML
}