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

// PageTableRow represents TL type `pageTableRow#e0c0c5e5`.
// Table row
//
// See https://core.telegram.org/constructor/pageTableRow for reference.
type PageTableRow struct {
	// Table cells
	Cells []PageTableCell
}

// PageTableRowTypeID is TL type id of PageTableRow.
const PageTableRowTypeID = 0xe0c0c5e5

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

func ( *PageTableRow) () bool {
	if  == nil {
		return true
	}
	if !(.Cells == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PageTableRow from given interface.
func ( *PageTableRow) ( interface {
	() ( []PageTableCell)
}) {
	.Cells = .()
}

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

// TypeName returns name of type in TL schema.
func (*PageTableRow) () string {
	return "pageTableRow"
}

// TypeInfo returns info about TL type.
func ( *PageTableRow) () tdp.Type {
	 := tdp.Type{
		Name: "pageTableRow",
		ID:   PageTableRowTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Cells",
			SchemaName: "cells",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PageTableRow) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode pageTableRow#e0c0c5e5 as nil")
	}
	.PutID(PageTableRowTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PageTableRow) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode pageTableRow#e0c0c5e5 as nil")
	}
	.PutVectorHeader(len(.Cells))
	for ,  := range .Cells {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode pageTableRow#e0c0c5e5: field cells element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PageTableRow) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode pageTableRow#e0c0c5e5 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode pageTableRow#e0c0c5e5: field cells: %w", )
		}

		if  > 0 {
			.Cells = make([]PageTableCell, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  PageTableCell
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode pageTableRow#e0c0c5e5: field cells: %w", )
			}
			.Cells = append(.Cells, )
		}
	}
	return nil
}

// GetCells returns value of Cells field.
func ( *PageTableRow) () ( []PageTableCell) {
	if  == nil {
		return
	}
	return .Cells
}