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

// AccountGetThemeRequest represents TL type `account.getTheme#3a5869ec`.
// Get theme information
//
// See https://core.telegram.org/method/account.getTheme for reference.
type AccountGetThemeRequest struct {
	// Theme format, a string that identifies the theming engines supported by the client
	Format string
	// Theme
	Theme InputThemeClass
}

// AccountGetThemeRequestTypeID is TL type id of AccountGetThemeRequest.
const AccountGetThemeRequestTypeID = 0x3a5869ec

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

func ( *AccountGetThemeRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Format == "") {
		return false
	}
	if !(.Theme == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AccountGetThemeRequest from given interface.
func ( *AccountGetThemeRequest) ( interface {
	() ( string)
	() ( InputThemeClass)
}) {
	.Format = .()
	.Theme = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountGetThemeRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.getTheme",
		ID:   AccountGetThemeRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Format",
			SchemaName: "format",
		},
		{
			Name:       "Theme",
			SchemaName: "theme",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountGetThemeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getTheme#3a5869ec as nil")
	}
	.PutID(AccountGetThemeRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountGetThemeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getTheme#3a5869ec as nil")
	}
	.PutString(.Format)
	if .Theme == nil {
		return fmt.Errorf("unable to encode account.getTheme#3a5869ec: field theme is nil")
	}
	if  := .Theme.Encode();  != nil {
		return fmt.Errorf("unable to encode account.getTheme#3a5869ec: field theme: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountGetThemeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.getTheme#3a5869ec to nil")
	}
	if  := .ConsumeID(AccountGetThemeRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.getTheme#3a5869ec: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountGetThemeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.getTheme#3a5869ec to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.getTheme#3a5869ec: field format: %w", )
		}
		.Format = 
	}
	{
		,  := DecodeInputTheme()
		if  != nil {
			return fmt.Errorf("unable to decode account.getTheme#3a5869ec: field theme: %w", )
		}
		.Theme = 
	}
	return nil
}

// GetFormat returns value of Format field.
func ( *AccountGetThemeRequest) () ( string) {
	if  == nil {
		return
	}
	return .Format
}

// GetTheme returns value of Theme field.
func ( *AccountGetThemeRequest) () ( InputThemeClass) {
	if  == nil {
		return
	}
	return .Theme
}

// AccountGetTheme invokes method account.getTheme#3a5869ec returning error if any.
// Get theme information
//
// Possible errors:
//
//	400 THEME_FORMAT_INVALID: Invalid theme format provided.
//	400 THEME_INVALID: Invalid theme provided.
//
// See https://core.telegram.org/method/account.getTheme for reference.
func ( *Client) ( context.Context,  *AccountGetThemeRequest) (*Theme, error) {
	var  Theme

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