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

// QuickReply represents TL type `quickReply#697102b`.
// A quick reply shortcut¹.
//
// Links:
//  1. https://core.telegram.org/api/business#quick-reply-shortcuts
//
// See https://core.telegram.org/constructor/quickReply for reference.
type QuickReply struct {
	// Unique shortcut ID.
	ShortcutID int
	// Shortcut name.
	Shortcut string
	// ID of the last message in the shortcut.
	TopMessage int
	// Total number of messages in the shortcut.
	Count int
}

// QuickReplyTypeID is TL type id of QuickReply.
const QuickReplyTypeID = 0x697102b

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

func ( *QuickReply) () bool {
	if  == nil {
		return true
	}
	if !(.ShortcutID == 0) {
		return false
	}
	if !(.Shortcut == "") {
		return false
	}
	if !(.TopMessage == 0) {
		return false
	}
	if !(.Count == 0) {
		return false
	}

	return true
}

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

// FillFrom fills QuickReply from given interface.
func ( *QuickReply) ( interface {
	() ( int)
	() ( string)
	() ( int)
	() ( int)
}) {
	.ShortcutID = .()
	.Shortcut = .()
	.TopMessage = .()
	.Count = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *QuickReply) () tdp.Type {
	 := tdp.Type{
		Name: "quickReply",
		ID:   QuickReplyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ShortcutID",
			SchemaName: "shortcut_id",
		},
		{
			Name:       "Shortcut",
			SchemaName: "shortcut",
		},
		{
			Name:       "TopMessage",
			SchemaName: "top_message",
		},
		{
			Name:       "Count",
			SchemaName: "count",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *QuickReply) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode quickReply#697102b as nil")
	}
	.PutID(QuickReplyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *QuickReply) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode quickReply#697102b as nil")
	}
	.PutInt(.ShortcutID)
	.PutString(.Shortcut)
	.PutInt(.TopMessage)
	.PutInt(.Count)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *QuickReply) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode quickReply#697102b to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode quickReply#697102b: field shortcut_id: %w", )
		}
		.ShortcutID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode quickReply#697102b: field shortcut: %w", )
		}
		.Shortcut = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode quickReply#697102b: field top_message: %w", )
		}
		.TopMessage = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode quickReply#697102b: field count: %w", )
		}
		.Count = 
	}
	return nil
}

// GetShortcutID returns value of ShortcutID field.
func ( *QuickReply) () ( int) {
	if  == nil {
		return
	}
	return .ShortcutID
}

// GetShortcut returns value of Shortcut field.
func ( *QuickReply) () ( string) {
	if  == nil {
		return
	}
	return .Shortcut
}

// GetTopMessage returns value of TopMessage field.
func ( *QuickReply) () ( int) {
	if  == nil {
		return
	}
	return .TopMessage
}

// GetCount returns value of Count field.
func ( *QuickReply) () ( int) {
	if  == nil {
		return
	}
	return .Count
}