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

// AccountSetMainProfileTabRequest represents TL type `account.setMainProfileTab#5dee78b0`.
// Changes the main profile tab of the current user, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/profile#tabs
//
// See https://core.telegram.org/method/account.setMainProfileTab for reference.
type AccountSetMainProfileTabRequest struct {
	// The tab to set as main tab.
	Tab ProfileTabClass
}

// AccountSetMainProfileTabRequestTypeID is TL type id of AccountSetMainProfileTabRequest.
const AccountSetMainProfileTabRequestTypeID = 0x5dee78b0

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

func ( *AccountSetMainProfileTabRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Tab == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AccountSetMainProfileTabRequest from given interface.
func ( *AccountSetMainProfileTabRequest) ( interface {
	() ( ProfileTabClass)
}) {
	.Tab = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountSetMainProfileTabRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.setMainProfileTab",
		ID:   AccountSetMainProfileTabRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Tab",
			SchemaName: "tab",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountSetMainProfileTabRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.setMainProfileTab#5dee78b0 as nil")
	}
	.PutID(AccountSetMainProfileTabRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountSetMainProfileTabRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.setMainProfileTab#5dee78b0 as nil")
	}
	if .Tab == nil {
		return fmt.Errorf("unable to encode account.setMainProfileTab#5dee78b0: field tab is nil")
	}
	if  := .Tab.Encode();  != nil {
		return fmt.Errorf("unable to encode account.setMainProfileTab#5dee78b0: field tab: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountSetMainProfileTabRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.setMainProfileTab#5dee78b0 to nil")
	}
	if  := .ConsumeID(AccountSetMainProfileTabRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.setMainProfileTab#5dee78b0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountSetMainProfileTabRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.setMainProfileTab#5dee78b0 to nil")
	}
	{
		,  := DecodeProfileTab()
		if  != nil {
			return fmt.Errorf("unable to decode account.setMainProfileTab#5dee78b0: field tab: %w", )
		}
		.Tab = 
	}
	return nil
}

// GetTab returns value of Tab field.
func ( *AccountSetMainProfileTabRequest) () ( ProfileTabClass) {
	if  == nil {
		return
	}
	return .Tab
}

// AccountSetMainProfileTab invokes method account.setMainProfileTab#5dee78b0 returning error if any.
// Changes the main profile tab of the current user, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/profile#tabs
//
// See https://core.telegram.org/method/account.setMainProfileTab for reference.
func ( *Client) ( context.Context,  ProfileTabClass) (bool, error) {
	var  BoolBox

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