// Code generated by gotdgen, DO NOT EDIT.

package tdapi

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)

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

// LoadQuickReplyShortcutsRequest represents TL type `loadQuickReplyShortcuts#c367b29d`.
type LoadQuickReplyShortcutsRequest struct {
}

// LoadQuickReplyShortcutsRequestTypeID is TL type id of LoadQuickReplyShortcutsRequest.
const LoadQuickReplyShortcutsRequestTypeID = 0xc367b29d

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

func (l *LoadQuickReplyShortcutsRequest) Zero() bool {
	if l == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (l *LoadQuickReplyShortcutsRequest) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "loadQuickReplyShortcuts",
		ID:   LoadQuickReplyShortcutsRequestTypeID,
	}
	if l == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (l *LoadQuickReplyShortcutsRequest) Encode(b *bin.Buffer) error {
	if l == nil {
		return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil")
	}
	b.PutID(LoadQuickReplyShortcutsRequestTypeID)
	return l.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (l *LoadQuickReplyShortcutsRequest) EncodeBare(b *bin.Buffer) error {
	if l == nil {
		return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (l *LoadQuickReplyShortcutsRequest) Decode(b *bin.Buffer) error {
	if l == nil {
		return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil")
	}
	if err := b.ConsumeID(LoadQuickReplyShortcutsRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode loadQuickReplyShortcuts#c367b29d: %w", err)
	}
	return l.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (l *LoadQuickReplyShortcutsRequest) DecodeBare(b *bin.Buffer) error {
	if l == nil {
		return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (l *LoadQuickReplyShortcutsRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
	if l == nil {
		return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil")
	}
	b.ObjStart()
	b.PutID("loadQuickReplyShortcuts")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (l *LoadQuickReplyShortcutsRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if l == nil {
		return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("loadQuickReplyShortcuts"); err != nil {
				return fmt.Errorf("unable to decode loadQuickReplyShortcuts#c367b29d: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// LoadQuickReplyShortcuts invokes method loadQuickReplyShortcuts#c367b29d returning error if any.
func (c *Client) LoadQuickReplyShortcuts(ctx context.Context) error {
	var ok Ok

	request := &LoadQuickReplyShortcutsRequest{}
	if err := c.rpc.Invoke(ctx, request, &ok); err != nil {
		return err
	}
	return nil
}
