//go:build !no_gotd_slices
// +build !no_gotd_slices

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

// ChatParticipantClassArray is adapter for slice of ChatParticipantClass.
type ChatParticipantClassArray []ChatParticipantClass

// Sort sorts slice of ChatParticipantClass.
func ( ChatParticipantClassArray) ( func(,  ChatParticipantClass) bool) ChatParticipantClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of ChatParticipantClass.
func ( ChatParticipantClassArray) ( func(,  ChatParticipantClass) bool) ChatParticipantClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of ChatParticipantClass.
func ( ChatParticipantClassArray) ( func( ChatParticipantClass) bool) ChatParticipantClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( ChatParticipantClassArray) () ( ChatParticipantClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( ChatParticipantClassArray) () ( ChatParticipantClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *ChatParticipantClassArray) () ( ChatParticipantClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  ChatParticipantClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *ChatParticipantClassArray) () ( ChatParticipantClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsChatParticipant returns copy with only ChatParticipant constructors.
func ( ChatParticipantClassArray) () ( ChatParticipantArray) {
	for ,  := range  {
		,  := .(*ChatParticipant)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsChatParticipantCreator returns copy with only ChatParticipantCreator constructors.
func ( ChatParticipantClassArray) () ( ChatParticipantCreatorArray) {
	for ,  := range  {
		,  := .(*ChatParticipantCreator)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsChatParticipantAdmin returns copy with only ChatParticipantAdmin constructors.
func ( ChatParticipantClassArray) () ( ChatParticipantAdminArray) {
	for ,  := range  {
		,  := .(*ChatParticipantAdmin)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// ChatParticipantArray is adapter for slice of ChatParticipant.
type ChatParticipantArray []ChatParticipant

// Sort sorts slice of ChatParticipant.
func ( ChatParticipantArray) ( func(,  ChatParticipant) bool) ChatParticipantArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of ChatParticipant.
func ( ChatParticipantArray) ( func(,  ChatParticipant) bool) ChatParticipantArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of ChatParticipant.
func ( ChatParticipantArray) ( func( ChatParticipant) bool) ChatParticipantArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( ChatParticipantArray) () ( ChatParticipant,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( ChatParticipantArray) () ( ChatParticipant,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *ChatParticipantArray) () ( ChatParticipant,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  ChatParticipant
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *ChatParticipantArray) () ( ChatParticipant,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByDate sorts slice of ChatParticipant by Date.
func ( ChatParticipantArray) () ChatParticipantArray {
	return .Sort(func(,  ChatParticipant) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of ChatParticipant by Date.
func ( ChatParticipantArray) () ChatParticipantArray {
	return .SortStable(func(,  ChatParticipant) bool {
		return .GetDate() < .GetDate()
	})
}

// ChatParticipantCreatorArray is adapter for slice of ChatParticipantCreator.
type ChatParticipantCreatorArray []ChatParticipantCreator

// Sort sorts slice of ChatParticipantCreator.
func ( ChatParticipantCreatorArray) ( func(,  ChatParticipantCreator) bool) ChatParticipantCreatorArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of ChatParticipantCreator.
func ( ChatParticipantCreatorArray) ( func(,  ChatParticipantCreator) bool) ChatParticipantCreatorArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of ChatParticipantCreator.
func ( ChatParticipantCreatorArray) ( func( ChatParticipantCreator) bool) ChatParticipantCreatorArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( ChatParticipantCreatorArray) () ( ChatParticipantCreator,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( ChatParticipantCreatorArray) () ( ChatParticipantCreator,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *ChatParticipantCreatorArray) () ( ChatParticipantCreator,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  ChatParticipantCreator
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *ChatParticipantCreatorArray) () ( ChatParticipantCreator,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// ChatParticipantAdminArray is adapter for slice of ChatParticipantAdmin.
type ChatParticipantAdminArray []ChatParticipantAdmin

// Sort sorts slice of ChatParticipantAdmin.
func ( ChatParticipantAdminArray) ( func(,  ChatParticipantAdmin) bool) ChatParticipantAdminArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of ChatParticipantAdmin.
func ( ChatParticipantAdminArray) ( func(,  ChatParticipantAdmin) bool) ChatParticipantAdminArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of ChatParticipantAdmin.
func ( ChatParticipantAdminArray) ( func( ChatParticipantAdmin) bool) ChatParticipantAdminArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( ChatParticipantAdminArray) () ( ChatParticipantAdmin,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( ChatParticipantAdminArray) () ( ChatParticipantAdmin,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *ChatParticipantAdminArray) () ( ChatParticipantAdmin,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  ChatParticipantAdmin
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *ChatParticipantAdminArray) () ( ChatParticipantAdmin,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByDate sorts slice of ChatParticipantAdmin by Date.
func ( ChatParticipantAdminArray) () ChatParticipantAdminArray {
	return .Sort(func(,  ChatParticipantAdmin) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of ChatParticipantAdmin by Date.
func ( ChatParticipantAdminArray) () ChatParticipantAdminArray {
	return .SortStable(func(,  ChatParticipantAdmin) bool {
		return .GetDate() < .GetDate()
	})
}