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

// HideContactCloseBirthdaysRequest represents TL type `hideContactCloseBirthdays#baad087b`.
type HideContactCloseBirthdaysRequest struct {
}

// HideContactCloseBirthdaysRequestTypeID is TL type id of HideContactCloseBirthdaysRequest.
const HideContactCloseBirthdaysRequestTypeID = 0xbaad087b

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

func (h *HideContactCloseBirthdaysRequest) Zero() bool {
	if h == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (h *HideContactCloseBirthdaysRequest) Encode(b *bin.Buffer) error {
	if h == nil {
		return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil")
	}
	b.PutID(HideContactCloseBirthdaysRequestTypeID)
	return h.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (h *HideContactCloseBirthdaysRequest) EncodeBare(b *bin.Buffer) error {
	if h == nil {
		return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (h *HideContactCloseBirthdaysRequest) Decode(b *bin.Buffer) error {
	if h == nil {
		return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil")
	}
	if err := b.ConsumeID(HideContactCloseBirthdaysRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode hideContactCloseBirthdays#baad087b: %w", err)
	}
	return h.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (h *HideContactCloseBirthdaysRequest) DecodeBare(b *bin.Buffer) error {
	if h == nil {
		return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (h *HideContactCloseBirthdaysRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if h == nil {
		return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil")
	}

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

// HideContactCloseBirthdays invokes method hideContactCloseBirthdays#baad087b returning error if any.
func (c *Client) HideContactCloseBirthdays(ctx context.Context) error {
	var ok Ok

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