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

// AccountCreateBusinessChatLinkRequest represents TL type `account.createBusinessChatLink#8851e68e`.
// Create a business chat deep link »¹.
//
// Links:
//  1. https://core.telegram.org/api/business#business-chat-links
//
// See https://core.telegram.org/method/account.createBusinessChatLink for reference.
type AccountCreateBusinessChatLinkRequest struct {
	// Info about the link to create.
	Link InputBusinessChatLink
}

// AccountCreateBusinessChatLinkRequestTypeID is TL type id of AccountCreateBusinessChatLinkRequest.
const AccountCreateBusinessChatLinkRequestTypeID = 0x8851e68e

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

func ( *AccountCreateBusinessChatLinkRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Link.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills AccountCreateBusinessChatLinkRequest from given interface.
func ( *AccountCreateBusinessChatLinkRequest) ( interface {
	() ( InputBusinessChatLink)
}) {
	.Link = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountCreateBusinessChatLinkRequest) () string {
	return "account.createBusinessChatLink"
}

// TypeInfo returns info about TL type.
func ( *AccountCreateBusinessChatLinkRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.createBusinessChatLink",
		ID:   AccountCreateBusinessChatLinkRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Link",
			SchemaName: "link",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountCreateBusinessChatLinkRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.createBusinessChatLink#8851e68e as nil")
	}
	.PutID(AccountCreateBusinessChatLinkRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountCreateBusinessChatLinkRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.createBusinessChatLink#8851e68e as nil")
	}
	if  := .Link.Encode();  != nil {
		return fmt.Errorf("unable to encode account.createBusinessChatLink#8851e68e: field link: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountCreateBusinessChatLinkRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.createBusinessChatLink#8851e68e to nil")
	}
	if  := .ConsumeID(AccountCreateBusinessChatLinkRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.createBusinessChatLink#8851e68e: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountCreateBusinessChatLinkRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.createBusinessChatLink#8851e68e to nil")
	}
	{
		if  := .Link.Decode();  != nil {
			return fmt.Errorf("unable to decode account.createBusinessChatLink#8851e68e: field link: %w", )
		}
	}
	return nil
}

// GetLink returns value of Link field.
func ( *AccountCreateBusinessChatLinkRequest) () ( InputBusinessChatLink) {
	if  == nil {
		return
	}
	return .Link
}

// AccountCreateBusinessChatLink invokes method account.createBusinessChatLink#8851e68e returning error if any.
// Create a business chat deep link »¹.
//
// Links:
//  1. https://core.telegram.org/api/business#business-chat-links
//
// Possible errors:
//
//	400 CHATLINKS_TOO_MUCH: Too many business chat links were created, please delete some older links.
//	400 DOCUMENT_INVALID: The specified document is invalid.
//	403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action.
//
// See https://core.telegram.org/method/account.createBusinessChatLink for reference.
func ( *Client) ( context.Context,  InputBusinessChatLink) (*BusinessChatLink, error) {
	var  BusinessChatLink

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