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

// MessagesHideChatJoinRequestRequest represents TL type `messages.hideChatJoinRequest#7fe7e815`.
// Dismiss or approve a chat join request¹ related to a specific chat or channel.
//
// Links:
//  1. https://core.telegram.org/api/invites#join-requests
//
// See https://core.telegram.org/method/messages.hideChatJoinRequest for reference.
type MessagesHideChatJoinRequestRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to dismiss or approve the chat join request »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/invites#join-requests
	Approved bool
	// The chat or channel
	Peer InputPeerClass
	// The user whose join request »¹ should be dismissed or approved
	//
	// Links:
	//  1) https://core.telegram.org/api/invites#join-requests
	UserID InputUserClass
}

// MessagesHideChatJoinRequestRequestTypeID is TL type id of MessagesHideChatJoinRequestRequest.
const MessagesHideChatJoinRequestRequestTypeID = 0x7fe7e815

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

func ( *MessagesHideChatJoinRequestRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Approved == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.UserID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesHideChatJoinRequestRequest from given interface.
func ( *MessagesHideChatJoinRequestRequest) ( interface {
	() ( bool)
	() ( InputPeerClass)
	() ( InputUserClass)
}) {
	.Approved = .()
	.Peer = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesHideChatJoinRequestRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.hideChatJoinRequest",
		ID:   MessagesHideChatJoinRequestRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Approved",
			SchemaName: "approved",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesHideChatJoinRequestRequest) () {
	if !(.Approved == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesHideChatJoinRequestRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.hideChatJoinRequest#7fe7e815 as nil")
	}
	.PutID(MessagesHideChatJoinRequestRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesHideChatJoinRequestRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.hideChatJoinRequest#7fe7e815 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.hideChatJoinRequest#7fe7e815: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.hideChatJoinRequest#7fe7e815: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.hideChatJoinRequest#7fe7e815: field peer: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode messages.hideChatJoinRequest#7fe7e815: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.hideChatJoinRequest#7fe7e815: field user_id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesHideChatJoinRequestRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.hideChatJoinRequest#7fe7e815 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.hideChatJoinRequest#7fe7e815: field flags: %w", )
		}
	}
	.Approved = .Flags.Has(0)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.hideChatJoinRequest#7fe7e815: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode messages.hideChatJoinRequest#7fe7e815: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// SetApproved sets value of Approved conditional field.
func ( *MessagesHideChatJoinRequestRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Approved = true
	} else {
		.Flags.Unset(0)
		.Approved = false
	}
}

// GetApproved returns value of Approved conditional field.
func ( *MessagesHideChatJoinRequestRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetPeer returns value of Peer field.
func ( *MessagesHideChatJoinRequestRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetUserID returns value of UserID field.
func ( *MessagesHideChatJoinRequestRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// MessagesHideChatJoinRequest invokes method messages.hideChatJoinRequest#7fe7e815 returning error if any.
// Dismiss or approve a chat join request¹ related to a specific chat or channel.
//
// Links:
//  1. https://core.telegram.org/api/invites#join-requests
//
// Possible errors:
//
//	400 CHANNELS_TOO_MUCH: You have joined too many channels/supergroups.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 HIDE_REQUESTER_MISSING: The join request was missing or was already handled.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 USER_ALREADY_PARTICIPANT: The user is already in the group.
//	403 USER_CHANNELS_TOO_MUCH: One of the users you tried to add is already in too many channels/supergroups.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/messages.hideChatJoinRequest for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesHideChatJoinRequestRequest) (UpdatesClass, error) {
	var  UpdatesBox

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