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

// UploadSaveBigFilePartRequest represents TL type `upload.saveBigFilePart#de7b673d`.
// Saves a part of a large file (over 10 MB in size) to be later passed to one of the
// methods.
//
// See https://core.telegram.org/method/upload.saveBigFilePart for reference.
type UploadSaveBigFilePartRequest struct {
	// Random file id, created by the client
	FileID int64
	// Part sequence number
	FilePart int
	// Total number of parts
	FileTotalParts int
	// Binary data, part contents
	Bytes []byte
}

// UploadSaveBigFilePartRequestTypeID is TL type id of UploadSaveBigFilePartRequest.
const UploadSaveBigFilePartRequestTypeID = 0xde7b673d

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

func ( *UploadSaveBigFilePartRequest) () bool {
	if  == nil {
		return true
	}
	if !(.FileID == 0) {
		return false
	}
	if !(.FilePart == 0) {
		return false
	}
	if !(.FileTotalParts == 0) {
		return false
	}
	if !(.Bytes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills UploadSaveBigFilePartRequest from given interface.
func ( *UploadSaveBigFilePartRequest) ( interface {
	() ( int64)
	() ( int)
	() ( int)
	() ( []byte)
}) {
	.FileID = .()
	.FilePart = .()
	.FileTotalParts = .()
	.Bytes = .()
}

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

// TypeName returns name of type in TL schema.
func (*UploadSaveBigFilePartRequest) () string {
	return "upload.saveBigFilePart"
}

// TypeInfo returns info about TL type.
func ( *UploadSaveBigFilePartRequest) () tdp.Type {
	 := tdp.Type{
		Name: "upload.saveBigFilePart",
		ID:   UploadSaveBigFilePartRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "FileID",
			SchemaName: "file_id",
		},
		{
			Name:       "FilePart",
			SchemaName: "file_part",
		},
		{
			Name:       "FileTotalParts",
			SchemaName: "file_total_parts",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UploadSaveBigFilePartRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode upload.saveBigFilePart#de7b673d as nil")
	}
	.PutID(UploadSaveBigFilePartRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UploadSaveBigFilePartRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode upload.saveBigFilePart#de7b673d as nil")
	}
	.PutLong(.FileID)
	.PutInt(.FilePart)
	.PutInt(.FileTotalParts)
	.PutBytes(.Bytes)
	return nil
}

// Decode implements bin.Decoder.
func ( *UploadSaveBigFilePartRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode upload.saveBigFilePart#de7b673d to nil")
	}
	if  := .ConsumeID(UploadSaveBigFilePartRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode upload.saveBigFilePart#de7b673d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *UploadSaveBigFilePartRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode upload.saveBigFilePart#de7b673d to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode upload.saveBigFilePart#de7b673d: field file_id: %w", )
		}
		.FileID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode upload.saveBigFilePart#de7b673d: field file_part: %w", )
		}
		.FilePart = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode upload.saveBigFilePart#de7b673d: field file_total_parts: %w", )
		}
		.FileTotalParts = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode upload.saveBigFilePart#de7b673d: field bytes: %w", )
		}
		.Bytes = 
	}
	return nil
}

// GetFileID returns value of FileID field.
func ( *UploadSaveBigFilePartRequest) () ( int64) {
	if  == nil {
		return
	}
	return .FileID
}

// GetFilePart returns value of FilePart field.
func ( *UploadSaveBigFilePartRequest) () ( int) {
	if  == nil {
		return
	}
	return .FilePart
}

// GetFileTotalParts returns value of FileTotalParts field.
func ( *UploadSaveBigFilePartRequest) () ( int) {
	if  == nil {
		return
	}
	return .FileTotalParts
}

// GetBytes returns value of Bytes field.
func ( *UploadSaveBigFilePartRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .Bytes
}

// UploadSaveBigFilePart invokes method upload.saveBigFilePart#de7b673d returning error if any.
// Saves a part of a large file (over 10 MB in size) to be later passed to one of the
// methods.
//
// Possible errors:
//
//	400 FILE_PARTS_INVALID: The number of file parts is invalid.
//	400 FILE_PART_EMPTY: The provided file part is empty.
//	400 FILE_PART_INVALID: The file part number is invalid.
//	400 FILE_PART_SIZE_CHANGED: Provided file part size has changed.
//	400 FILE_PART_SIZE_INVALID: The provided file part size is invalid.
//	400 FILE_PART_TOO_BIG: The uploaded file part is too big.
//
// See https://core.telegram.org/method/upload.saveBigFilePart for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *UploadSaveBigFilePartRequest) (bool, error) {
	var  BoolBox

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