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

// ActivateStoryStealthModeRequest represents TL type `activateStoryStealthMode#c3db8491`.
type ActivateStoryStealthModeRequest struct {
}

// ActivateStoryStealthModeRequestTypeID is TL type id of ActivateStoryStealthModeRequest.
const ActivateStoryStealthModeRequestTypeID = 0xc3db8491

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

func (a *ActivateStoryStealthModeRequest) Zero() bool {
	if a == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (a *ActivateStoryStealthModeRequest) Encode(b *bin.Buffer) error {
	if a == nil {
		return fmt.Errorf("can't encode activateStoryStealthMode#c3db8491 as nil")
	}
	b.PutID(ActivateStoryStealthModeRequestTypeID)
	return a.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (a *ActivateStoryStealthModeRequest) EncodeBare(b *bin.Buffer) error {
	if a == nil {
		return fmt.Errorf("can't encode activateStoryStealthMode#c3db8491 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (a *ActivateStoryStealthModeRequest) Decode(b *bin.Buffer) error {
	if a == nil {
		return fmt.Errorf("can't decode activateStoryStealthMode#c3db8491 to nil")
	}
	if err := b.ConsumeID(ActivateStoryStealthModeRequestTypeID); err != nil {
		return fmt.Errorf("unable to decode activateStoryStealthMode#c3db8491: %w", err)
	}
	return a.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (a *ActivateStoryStealthModeRequest) DecodeBare(b *bin.Buffer) error {
	if a == nil {
		return fmt.Errorf("can't decode activateStoryStealthMode#c3db8491 to nil")
	}
	return nil
}

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

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (a *ActivateStoryStealthModeRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if a == nil {
		return fmt.Errorf("can't decode activateStoryStealthMode#c3db8491 to nil")
	}

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

// ActivateStoryStealthMode invokes method activateStoryStealthMode#c3db8491 returning error if any.
func (c *Client) ActivateStoryStealthMode(ctx context.Context) error {
	var ok Ok

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