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

// MessagesFaveStickerRequest represents TL type `messages.faveSticker#b9ffc55b`.
// Mark or unmark a sticker as favorite
//
// See https://core.telegram.org/method/messages.faveSticker for reference.
type MessagesFaveStickerRequest struct {
	// Sticker in question
	ID InputDocumentClass
	// Whether to add or remove a sticker from favorites
	Unfave bool
}

// MessagesFaveStickerRequestTypeID is TL type id of MessagesFaveStickerRequest.
const MessagesFaveStickerRequestTypeID = 0xb9ffc55b

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

func ( *MessagesFaveStickerRequest) () bool {
	if  == nil {
		return true
	}
	if !(.ID == nil) {
		return false
	}
	if !(.Unfave == false) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesFaveStickerRequest from given interface.
func ( *MessagesFaveStickerRequest) ( interface {
	() ( InputDocumentClass)
	() ( bool)
}) {
	.ID = .()
	.Unfave = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesFaveStickerRequest) () string {
	return "messages.faveSticker"
}

// TypeInfo returns info about TL type.
func ( *MessagesFaveStickerRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.faveSticker",
		ID:   MessagesFaveStickerRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Unfave",
			SchemaName: "unfave",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesFaveStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.faveSticker#b9ffc55b as nil")
	}
	.PutID(MessagesFaveStickerRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesFaveStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.faveSticker#b9ffc55b as nil")
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode messages.faveSticker#b9ffc55b: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.faveSticker#b9ffc55b: field id: %w", )
	}
	.PutBool(.Unfave)
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesFaveStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.faveSticker#b9ffc55b to nil")
	}
	if  := .ConsumeID(MessagesFaveStickerRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.faveSticker#b9ffc55b: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesFaveStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.faveSticker#b9ffc55b to nil")
	}
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode messages.faveSticker#b9ffc55b: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode messages.faveSticker#b9ffc55b: field unfave: %w", )
		}
		.Unfave = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *MessagesFaveStickerRequest) () ( InputDocumentClass) {
	if  == nil {
		return
	}
	return .ID
}

// GetUnfave returns value of Unfave field.
func ( *MessagesFaveStickerRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Unfave
}

// GetIDAsNotEmpty returns mapped value of ID field.
func ( *MessagesFaveStickerRequest) () (*InputDocument, bool) {
	return .ID.AsNotEmpty()
}

// MessagesFaveSticker invokes method messages.faveSticker#b9ffc55b returning error if any.
// Mark or unmark a sticker as favorite
//
// Possible errors:
//
//	400 STICKER_ID_INVALID: The provided sticker ID is invalid.
//
// See https://core.telegram.org/method/messages.faveSticker for reference.
func ( *Client) ( context.Context,  *MessagesFaveStickerRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}