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

// ChatInviteAlready represents TL type `chatInviteAlready#5a686d7c`.
// The user has already joined this chat
//
// See https://core.telegram.org/constructor/chatInviteAlready for reference.
type ChatInviteAlready struct {
	// The chat connected to the invite
	Chat ChatClass
}

// ChatInviteAlreadyTypeID is TL type id of ChatInviteAlready.
const ChatInviteAlreadyTypeID = 0x5a686d7c

// construct implements constructor of ChatInviteClass.
func ( ChatInviteAlready) () ChatInviteClass { return & }

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

	_ ChatInviteClass = &ChatInviteAlready{}
)

func ( *ChatInviteAlready) () bool {
	if  == nil {
		return true
	}
	if !(.Chat == nil) {
		return false
	}

	return true
}

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

// FillFrom fills ChatInviteAlready from given interface.
func ( *ChatInviteAlready) ( interface {
	() ( ChatClass)
}) {
	.Chat = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChatInviteAlready) () tdp.Type {
	 := tdp.Type{
		Name: "chatInviteAlready",
		ID:   ChatInviteAlreadyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Chat",
			SchemaName: "chat",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChatInviteAlready) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatInviteAlready#5a686d7c as nil")
	}
	.PutID(ChatInviteAlreadyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChatInviteAlready) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatInviteAlready#5a686d7c as nil")
	}
	if .Chat == nil {
		return fmt.Errorf("unable to encode chatInviteAlready#5a686d7c: field chat is nil")
	}
	if  := .Chat.Encode();  != nil {
		return fmt.Errorf("unable to encode chatInviteAlready#5a686d7c: field chat: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChatInviteAlready) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatInviteAlready#5a686d7c to nil")
	}
	{
		,  := DecodeChat()
		if  != nil {
			return fmt.Errorf("unable to decode chatInviteAlready#5a686d7c: field chat: %w", )
		}
		.Chat = 
	}
	return nil
}

// GetChat returns value of Chat field.
func ( *ChatInviteAlready) () ( ChatClass) {
	if  == nil {
		return
	}
	return .Chat
}

// ChatInvite represents TL type `chatInvite#cde0ec40`.
// Chat invite info
//
// See https://core.telegram.org/constructor/chatInvite for reference.
type ChatInvite struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether this is a channel/supergroup¹ or a normal group²
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	//  2) https://core.telegram.org/api/channel
	Channel bool
	// Whether this is a channel¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	Broadcast bool
	// Whether this is a public channel/supergroup¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	Public bool
	// Whether this is a supergroup¹
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	Megagroup bool
	// Whether the join request »¹ must be first approved by an administrator
	//
	// Links:
	//  1) https://core.telegram.org/api/invites#join-requests
	RequestNeeded bool
	// Is this chat or channel verified by Telegram?
	Verified bool
	// This chat is probably a scam
	Scam bool
	// If set, this chat was reported by many users as a fake or scam: be careful when
	// interacting with it.
	Fake bool
	// Chat/supergroup/channel title
	Title string
	// Description of the group of channel
	//
	// Use SetAbout and GetAbout helpers.
	About string
	// Chat/supergroup/channel photo
	Photo PhotoClass
	// Participant count
	ParticipantsCount int
	// A few of the participants that are in the group
	//
	// Use SetParticipants and GetParticipants helpers.
	Participants []UserClass
	// Profile color palette ID¹
	//
	// Links:
	//  1) https://core.telegram.org/api/colors
	Color int
}

// ChatInviteTypeID is TL type id of ChatInvite.
const ChatInviteTypeID = 0xcde0ec40

// construct implements constructor of ChatInviteClass.
func ( ChatInvite) () ChatInviteClass { return & }

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

	_ ChatInviteClass = &ChatInvite{}
)

func ( *ChatInvite) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Channel == false) {
		return false
	}
	if !(.Broadcast == false) {
		return false
	}
	if !(.Public == false) {
		return false
	}
	if !(.Megagroup == false) {
		return false
	}
	if !(.RequestNeeded == false) {
		return false
	}
	if !(.Verified == false) {
		return false
	}
	if !(.Scam == false) {
		return false
	}
	if !(.Fake == false) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.About == "") {
		return false
	}
	if !(.Photo == nil) {
		return false
	}
	if !(.ParticipantsCount == 0) {
		return false
	}
	if !(.Participants == nil) {
		return false
	}
	if !(.Color == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ChatInvite from given interface.
func ( *ChatInvite) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( string)
	() ( string,  bool)
	() ( PhotoClass)
	() ( int)
	() ( []UserClass,  bool)
	() ( int)
}) {
	.Channel = .()
	.Broadcast = .()
	.Public = .()
	.Megagroup = .()
	.RequestNeeded = .()
	.Verified = .()
	.Scam = .()
	.Fake = .()
	.Title = .()
	if ,  := .();  {
		.About = 
	}

	.Photo = .()
	.ParticipantsCount = .()
	if ,  := .();  {
		.Participants = 
	}

	.Color = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChatInvite) () tdp.Type {
	 := tdp.Type{
		Name: "chatInvite",
		ID:   ChatInviteTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Broadcast",
			SchemaName: "broadcast",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Public",
			SchemaName: "public",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Megagroup",
			SchemaName: "megagroup",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "RequestNeeded",
			SchemaName: "request_needed",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "Verified",
			SchemaName: "verified",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "Scam",
			SchemaName: "scam",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "Fake",
			SchemaName: "fake",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "About",
			SchemaName: "about",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
		},
		{
			Name:       "ParticipantsCount",
			SchemaName: "participants_count",
		},
		{
			Name:       "Participants",
			SchemaName: "participants",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Color",
			SchemaName: "color",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *ChatInvite) () {
	if !(.Channel == false) {
		.Flags.Set(0)
	}
	if !(.Broadcast == false) {
		.Flags.Set(1)
	}
	if !(.Public == false) {
		.Flags.Set(2)
	}
	if !(.Megagroup == false) {
		.Flags.Set(3)
	}
	if !(.RequestNeeded == false) {
		.Flags.Set(6)
	}
	if !(.Verified == false) {
		.Flags.Set(7)
	}
	if !(.Scam == false) {
		.Flags.Set(8)
	}
	if !(.Fake == false) {
		.Flags.Set(9)
	}
	if !(.About == "") {
		.Flags.Set(5)
	}
	if !(.Participants == nil) {
		.Flags.Set(4)
	}
}

// Encode implements bin.Encoder.
func ( *ChatInvite) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatInvite#cde0ec40 as nil")
	}
	.PutID(ChatInviteTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChatInvite) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatInvite#cde0ec40 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode chatInvite#cde0ec40: field flags: %w", )
	}
	.PutString(.Title)
	if .Flags.Has(5) {
		.PutString(.About)
	}
	if .Photo == nil {
		return fmt.Errorf("unable to encode chatInvite#cde0ec40: field photo is nil")
	}
	if  := .Photo.Encode();  != nil {
		return fmt.Errorf("unable to encode chatInvite#cde0ec40: field photo: %w", )
	}
	.PutInt(.ParticipantsCount)
	if .Flags.Has(4) {
		.PutVectorHeader(len(.Participants))
		for ,  := range .Participants {
			if  == nil {
				return fmt.Errorf("unable to encode chatInvite#cde0ec40: field participants element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode chatInvite#cde0ec40: field participants element with index %d: %w", , )
			}
		}
	}
	.PutInt(.Color)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChatInvite) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatInvite#cde0ec40 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field flags: %w", )
		}
	}
	.Channel = .Flags.Has(0)
	.Broadcast = .Flags.Has(1)
	.Public = .Flags.Has(2)
	.Megagroup = .Flags.Has(3)
	.RequestNeeded = .Flags.Has(6)
	.Verified = .Flags.Has(7)
	.Scam = .Flags.Has(8)
	.Fake = .Flags.Has(9)
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field title: %w", )
		}
		.Title = 
	}
	if .Flags.Has(5) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field about: %w", )
		}
		.About = 
	}
	{
		,  := DecodePhoto()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field photo: %w", )
		}
		.Photo = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field participants_count: %w", )
		}
		.ParticipantsCount = 
	}
	if .Flags.Has(4) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field participants: %w", )
		}

		if  > 0 {
			.Participants = make([]UserClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeUser()
			if  != nil {
				return fmt.Errorf("unable to decode chatInvite#cde0ec40: field participants: %w", )
			}
			.Participants = append(.Participants, )
		}
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvite#cde0ec40: field color: %w", )
		}
		.Color = 
	}
	return nil
}

// SetChannel sets value of Channel conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(0)
		.Channel = true
	} else {
		.Flags.Unset(0)
		.Channel = false
	}
}

// GetChannel returns value of Channel conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetBroadcast sets value of Broadcast conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(1)
		.Broadcast = true
	} else {
		.Flags.Unset(1)
		.Broadcast = false
	}
}

// GetBroadcast returns value of Broadcast conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetPublic sets value of Public conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(2)
		.Public = true
	} else {
		.Flags.Unset(2)
		.Public = false
	}
}

// GetPublic returns value of Public conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetMegagroup sets value of Megagroup conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(3)
		.Megagroup = true
	} else {
		.Flags.Unset(3)
		.Megagroup = false
	}
}

// GetMegagroup returns value of Megagroup conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetRequestNeeded sets value of RequestNeeded conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(6)
		.RequestNeeded = true
	} else {
		.Flags.Unset(6)
		.RequestNeeded = false
	}
}

// GetRequestNeeded returns value of RequestNeeded conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// SetVerified sets value of Verified conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(7)
		.Verified = true
	} else {
		.Flags.Unset(7)
		.Verified = false
	}
}

// GetVerified returns value of Verified conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(7)
}

// SetScam sets value of Scam conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(8)
		.Scam = true
	} else {
		.Flags.Unset(8)
		.Scam = false
	}
}

// GetScam returns value of Scam conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(8)
}

// SetFake sets value of Fake conditional field.
func ( *ChatInvite) ( bool) {
	if  {
		.Flags.Set(9)
		.Fake = true
	} else {
		.Flags.Unset(9)
		.Fake = false
	}
}

// GetFake returns value of Fake conditional field.
func ( *ChatInvite) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// GetTitle returns value of Title field.
func ( *ChatInvite) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// SetAbout sets value of About conditional field.
func ( *ChatInvite) ( string) {
	.Flags.Set(5)
	.About = 
}

// GetAbout returns value of About conditional field and
// boolean which is true if field was set.
func ( *ChatInvite) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(5) {
		return , false
	}
	return .About, true
}

// GetPhoto returns value of Photo field.
func ( *ChatInvite) () ( PhotoClass) {
	if  == nil {
		return
	}
	return .Photo
}

// GetParticipantsCount returns value of ParticipantsCount field.
func ( *ChatInvite) () ( int) {
	if  == nil {
		return
	}
	return .ParticipantsCount
}

// SetParticipants sets value of Participants conditional field.
func ( *ChatInvite) ( []UserClass) {
	.Flags.Set(4)
	.Participants = 
}

// GetParticipants returns value of Participants conditional field and
// boolean which is true if field was set.
func ( *ChatInvite) () ( []UserClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .Participants, true
}

// GetColor returns value of Color field.
func ( *ChatInvite) () ( int) {
	if  == nil {
		return
	}
	return .Color
}

// MapParticipants returns field Participants wrapped in UserClassArray helper.
func ( *ChatInvite) () ( UserClassArray,  bool) {
	if !.Flags.Has(4) {
		return , false
	}
	return UserClassArray(.Participants), true
}

// ChatInvitePeek represents TL type `chatInvitePeek#61695cb0`.
// A chat invitation that also allows peeking into the group to read messages without
// joining it.
//
// See https://core.telegram.org/constructor/chatInvitePeek for reference.
type ChatInvitePeek struct {
	// Chat information
	Chat ChatClass
	// Read-only anonymous access to this group will be revoked at this date
	Expires int
}

// ChatInvitePeekTypeID is TL type id of ChatInvitePeek.
const ChatInvitePeekTypeID = 0x61695cb0

// construct implements constructor of ChatInviteClass.
func ( ChatInvitePeek) () ChatInviteClass { return & }

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

	_ ChatInviteClass = &ChatInvitePeek{}
)

func ( *ChatInvitePeek) () bool {
	if  == nil {
		return true
	}
	if !(.Chat == nil) {
		return false
	}
	if !(.Expires == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ChatInvitePeek from given interface.
func ( *ChatInvitePeek) ( interface {
	() ( ChatClass)
	() ( int)
}) {
	.Chat = .()
	.Expires = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChatInvitePeek) () tdp.Type {
	 := tdp.Type{
		Name: "chatInvitePeek",
		ID:   ChatInvitePeekTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Chat",
			SchemaName: "chat",
		},
		{
			Name:       "Expires",
			SchemaName: "expires",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChatInvitePeek) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatInvitePeek#61695cb0 as nil")
	}
	.PutID(ChatInvitePeekTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChatInvitePeek) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode chatInvitePeek#61695cb0 as nil")
	}
	if .Chat == nil {
		return fmt.Errorf("unable to encode chatInvitePeek#61695cb0: field chat is nil")
	}
	if  := .Chat.Encode();  != nil {
		return fmt.Errorf("unable to encode chatInvitePeek#61695cb0: field chat: %w", )
	}
	.PutInt(.Expires)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChatInvitePeek) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode chatInvitePeek#61695cb0 to nil")
	}
	{
		,  := DecodeChat()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvitePeek#61695cb0: field chat: %w", )
		}
		.Chat = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode chatInvitePeek#61695cb0: field expires: %w", )
		}
		.Expires = 
	}
	return nil
}

// GetChat returns value of Chat field.
func ( *ChatInvitePeek) () ( ChatClass) {
	if  == nil {
		return
	}
	return .Chat
}

// GetExpires returns value of Expires field.
func ( *ChatInvitePeek) () ( int) {
	if  == nil {
		return
	}
	return .Expires
}

// ChatInviteClassName is schema name of ChatInviteClass.
const ChatInviteClassName = "ChatInvite"

// ChatInviteClass represents ChatInvite generic type.
//
// See https://core.telegram.org/type/ChatInvite for reference.
//
// Example:
//
//	g, err := tg.DecodeChatInvite(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.ChatInviteAlready: // chatInviteAlready#5a686d7c
//	case *tg.ChatInvite: // chatInvite#cde0ec40
//	case *tg.ChatInvitePeek: // chatInvitePeek#61695cb0
//	default: panic(v)
//	}
type ChatInviteClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() ChatInviteClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeChatInvite implements binary de-serialization for ChatInviteClass.
func ( *bin.Buffer) (ChatInviteClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case ChatInviteAlreadyTypeID:
		// Decoding chatInviteAlready#5a686d7c.
		 := ChatInviteAlready{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode ChatInviteClass: %w", )
		}
		return &, nil
	case ChatInviteTypeID:
		// Decoding chatInvite#cde0ec40.
		 := ChatInvite{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode ChatInviteClass: %w", )
		}
		return &, nil
	case ChatInvitePeekTypeID:
		// Decoding chatInvitePeek#61695cb0.
		 := ChatInvitePeek{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode ChatInviteClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode ChatInviteClass: %w", bin.NewUnexpectedID())
	}
}

// ChatInvite boxes the ChatInviteClass providing a helper.
type ChatInviteBox struct {
	ChatInvite ChatInviteClass
}

// Decode implements bin.Decoder for ChatInviteBox.
func ( *ChatInviteBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode ChatInviteBox to nil")
	}
	,  := DecodeChatInvite()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.ChatInvite = 
	return nil
}

// Encode implements bin.Encode for ChatInviteBox.
func ( *ChatInviteBox) ( *bin.Buffer) error {
	if  == nil || .ChatInvite == nil {
		return fmt.Errorf("unable to encode ChatInviteClass as nil")
	}
	return .ChatInvite.Encode()
}