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

// ChatAdminWithInvites represents TL type `chatAdminWithInvites#f2ecef23`.
// Info about chat invites generated by admins.
//
// See https://core.telegram.org/constructor/chatAdminWithInvites for reference.
type ChatAdminWithInvites struct {
	// The admin
	AdminID int64
	// Number of invites generated by the admin
	InvitesCount int
	// Number of revoked invites
	RevokedInvitesCount int
}

// ChatAdminWithInvitesTypeID is TL type id of ChatAdminWithInvites.
const ChatAdminWithInvitesTypeID = 0xf2ecef23

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

func ( *ChatAdminWithInvites) () bool {
	if  == nil {
		return true
	}
	if !(.AdminID == 0) {
		return false
	}
	if !(.InvitesCount == 0) {
		return false
	}
	if !(.RevokedInvitesCount == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ChatAdminWithInvites from given interface.
func ( *ChatAdminWithInvites) ( interface {
	() ( int64)
	() ( int)
	() ( int)
}) {
	.AdminID = .()
	.InvitesCount = .()
	.RevokedInvitesCount = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChatAdminWithInvites) () tdp.Type {
	 := tdp.Type{
		Name: "chatAdminWithInvites",
		ID:   ChatAdminWithInvitesTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "AdminID",
			SchemaName: "admin_id",
		},
		{
			Name:       "InvitesCount",
			SchemaName: "invites_count",
		},
		{
			Name:       "RevokedInvitesCount",
			SchemaName: "revoked_invites_count",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChatAdminWithInvites) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatAdminWithInvites#f2ecef23 as nil")
	}
	.PutID(ChatAdminWithInvitesTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChatAdminWithInvites) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatAdminWithInvites#f2ecef23 as nil")
	}
	.PutLong(.AdminID)
	.PutInt(.InvitesCount)
	.PutInt(.RevokedInvitesCount)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChatAdminWithInvites) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatAdminWithInvites#f2ecef23 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode chatAdminWithInvites#f2ecef23: field admin_id: %w", )
		}
		.AdminID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode chatAdminWithInvites#f2ecef23: field invites_count: %w", )
		}
		.InvitesCount = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode chatAdminWithInvites#f2ecef23: field revoked_invites_count: %w", )
		}
		.RevokedInvitesCount = 
	}
	return nil
}

// GetAdminID returns value of AdminID field.
func ( *ChatAdminWithInvites) () ( int64) {
	if  == nil {
		return
	}
	return .AdminID
}

// GetInvitesCount returns value of InvitesCount field.
func ( *ChatAdminWithInvites) () ( int) {
	if  == nil {
		return
	}
	return .InvitesCount
}

// GetRevokedInvitesCount returns value of RevokedInvitesCount field.
func ( *ChatAdminWithInvites) () ( int) {
	if  == nil {
		return
	}
	return .RevokedInvitesCount
}