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

// GetDefaultBackgroundCustomEmojiStickersRequest represents TL type `getDefaultBackgroundCustomEmojiStickers#1cf6680e`.
type GetDefaultBackgroundCustomEmojiStickersRequest struct {
}

// GetDefaultBackgroundCustomEmojiStickersRequestTypeID is TL type id of GetDefaultBackgroundCustomEmojiStickersRequest.
const GetDefaultBackgroundCustomEmojiStickersRequestTypeID = 0x1cf6680e

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

func (g *GetDefaultBackgroundCustomEmojiStickersRequest) Zero() bool {
	if g == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (g *GetDefaultBackgroundCustomEmojiStickersRequest) Encode(b *bin.Buffer) error {
	if g == nil {
		return fmt.Errorf("can't encode getDefaultBackgroundCustomEmojiStickers#1cf6680e as nil")
	}
	b.PutID(GetDefaultBackgroundCustomEmojiStickersRequestTypeID)
	return g.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (g *GetDefaultBackgroundCustomEmojiStickersRequest) EncodeBare(b *bin.Buffer) error {
	if g == nil {
		return fmt.Errorf("can't encode getDefaultBackgroundCustomEmojiStickers#1cf6680e as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (g *GetDefaultBackgroundCustomEmojiStickersRequest) Decode(b *bin.Buffer) error {
	if g == nil {
		return fmt.Errorf("can't decode getDefaultBackgroundCustomEmojiStickers#1cf6680e to nil")
	}
	if err := b.ConsumeID(GetDefaultBackgroundCustomEmojiStickersRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode getDefaultBackgroundCustomEmojiStickers#1cf6680e: %w", err)
	}
	return g.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (g *GetDefaultBackgroundCustomEmojiStickersRequest) DecodeBare(b *bin.Buffer) error {
	if g == nil {
		return fmt.Errorf("can't decode getDefaultBackgroundCustomEmojiStickers#1cf6680e to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (g *GetDefaultBackgroundCustomEmojiStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
	if g == nil {
		return fmt.Errorf("can't encode getDefaultBackgroundCustomEmojiStickers#1cf6680e as nil")
	}
	b.ObjStart()
	b.PutID("getDefaultBackgroundCustomEmojiStickers")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (g *GetDefaultBackgroundCustomEmojiStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if g == nil {
		return fmt.Errorf("can't decode getDefaultBackgroundCustomEmojiStickers#1cf6680e to nil")
	}

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

// GetDefaultBackgroundCustomEmojiStickers invokes method getDefaultBackgroundCustomEmojiStickers#1cf6680e returning error if any.
func (c *Client) GetDefaultBackgroundCustomEmojiStickers(ctx context.Context) (*Stickers, error) {
	var result Stickers

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