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

// MessagesCheckChatInviteRequest represents TL type `messages.checkChatInvite#3eadb1bb`.
// Check the validity of a chat invite link and get basic info about it
//
// See https://core.telegram.org/method/messages.checkChatInvite for reference.
type MessagesCheckChatInviteRequest struct {
	// Invite hash from chat invite deep link »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#chat-invite-links
	Hash string
}

// MessagesCheckChatInviteRequestTypeID is TL type id of MessagesCheckChatInviteRequest.
const MessagesCheckChatInviteRequestTypeID = 0x3eadb1bb

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

func ( *MessagesCheckChatInviteRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Hash == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesCheckChatInviteRequest from given interface.
func ( *MessagesCheckChatInviteRequest) ( interface {
	() ( string)
}) {
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesCheckChatInviteRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.checkChatInvite",
		ID:   MessagesCheckChatInviteRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesCheckChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkChatInvite#3eadb1bb as nil")
	}
	.PutID(MessagesCheckChatInviteRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesCheckChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkChatInvite#3eadb1bb as nil")
	}
	.PutString(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesCheckChatInviteRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.checkChatInvite#3eadb1bb to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.checkChatInvite#3eadb1bb: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetHash returns value of Hash field.
func ( *MessagesCheckChatInviteRequest) () ( string) {
	if  == nil {
		return
	}
	return .Hash
}

// MessagesCheckChatInvite invokes method messages.checkChatInvite#3eadb1bb returning error if any.
// Check the validity of a chat invite link and get basic info about it
//
// Possible errors:
//
//	406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 INVITE_HASH_EMPTY: The invite hash is empty.
//	406 INVITE_HASH_EXPIRED: The invite link has expired.
//	400 INVITE_HASH_INVALID: The invite hash is invalid.
//
// See https://core.telegram.org/method/messages.checkChatInvite for reference.
func ( *Client) ( context.Context,  string) (ChatInviteClass, error) {
	var  ChatInviteBox

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