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

// ContactsBlockFromRepliesRequest represents TL type `contacts.blockFromReplies#29a8962c`.
// Stop getting notifications about discussion replies¹ of a certain user in @replies
//
// Links:
//  1. https://core.telegram.org/api/discussion
//
// See https://core.telegram.org/method/contacts.blockFromReplies for reference.
type ContactsBlockFromRepliesRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to delete the specified message as well
	DeleteMessage bool
	// Whether to delete all @replies messages from this user as well
	DeleteHistory bool
	// Whether to also report this user for spam
	ReportSpam bool
	// ID of the message in the @replies¹ chat
	//
	// Links:
	//  1) https://core.telegram.org/api/discussion#replies
	MsgID int
}

// ContactsBlockFromRepliesRequestTypeID is TL type id of ContactsBlockFromRepliesRequest.
const ContactsBlockFromRepliesRequestTypeID = 0x29a8962c

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

func ( *ContactsBlockFromRepliesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.DeleteMessage == false) {
		return false
	}
	if !(.DeleteHistory == false) {
		return false
	}
	if !(.ReportSpam == false) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ContactsBlockFromRepliesRequest from given interface.
func ( *ContactsBlockFromRepliesRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( int)
}) {
	.DeleteMessage = .()
	.DeleteHistory = .()
	.ReportSpam = .()
	.MsgID = .()
}

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

// TypeName returns name of type in TL schema.
func (*ContactsBlockFromRepliesRequest) () string {
	return "contacts.blockFromReplies"
}

// TypeInfo returns info about TL type.
func ( *ContactsBlockFromRepliesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "contacts.blockFromReplies",
		ID:   ContactsBlockFromRepliesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "DeleteMessage",
			SchemaName: "delete_message",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "DeleteHistory",
			SchemaName: "delete_history",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "ReportSpam",
			SchemaName: "report_spam",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *ContactsBlockFromRepliesRequest) () {
	if !(.DeleteMessage == false) {
		.Flags.Set(0)
	}
	if !(.DeleteHistory == false) {
		.Flags.Set(1)
	}
	if !(.ReportSpam == false) {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *ContactsBlockFromRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.blockFromReplies#29a8962c as nil")
	}
	.PutID(ContactsBlockFromRepliesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ContactsBlockFromRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.blockFromReplies#29a8962c as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode contacts.blockFromReplies#29a8962c: field flags: %w", )
	}
	.PutInt(.MsgID)
	return nil
}

// Decode implements bin.Decoder.
func ( *ContactsBlockFromRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.blockFromReplies#29a8962c to nil")
	}
	if  := .ConsumeID(ContactsBlockFromRepliesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode contacts.blockFromReplies#29a8962c: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ContactsBlockFromRepliesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.blockFromReplies#29a8962c to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode contacts.blockFromReplies#29a8962c: field flags: %w", )
		}
	}
	.DeleteMessage = .Flags.Has(0)
	.DeleteHistory = .Flags.Has(1)
	.ReportSpam = .Flags.Has(2)
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode contacts.blockFromReplies#29a8962c: field msg_id: %w", )
		}
		.MsgID = 
	}
	return nil
}

// SetDeleteMessage sets value of DeleteMessage conditional field.
func ( *ContactsBlockFromRepliesRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.DeleteMessage = true
	} else {
		.Flags.Unset(0)
		.DeleteMessage = false
	}
}

// GetDeleteMessage returns value of DeleteMessage conditional field.
func ( *ContactsBlockFromRepliesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetDeleteHistory sets value of DeleteHistory conditional field.
func ( *ContactsBlockFromRepliesRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.DeleteHistory = true
	} else {
		.Flags.Unset(1)
		.DeleteHistory = false
	}
}

// GetDeleteHistory returns value of DeleteHistory conditional field.
func ( *ContactsBlockFromRepliesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetReportSpam sets value of ReportSpam conditional field.
func ( *ContactsBlockFromRepliesRequest) ( bool) {
	if  {
		.Flags.Set(2)
		.ReportSpam = true
	} else {
		.Flags.Unset(2)
		.ReportSpam = false
	}
}

// GetReportSpam returns value of ReportSpam conditional field.
func ( *ContactsBlockFromRepliesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// GetMsgID returns value of MsgID field.
func ( *ContactsBlockFromRepliesRequest) () ( int) {
	if  == nil {
		return
	}
	return .MsgID
}

// ContactsBlockFromReplies invokes method contacts.blockFromReplies#29a8962c returning error if any.
// Stop getting notifications about discussion replies¹ of a certain user in @replies
//
// Links:
//  1. https://core.telegram.org/api/discussion
//
// See https://core.telegram.org/method/contacts.blockFromReplies for reference.
func ( *Client) ( context.Context,  *ContactsBlockFromRepliesRequest) (UpdatesClass, error) {
	var  UpdatesBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Updates, nil
}