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

// BotAppClassArray is adapter for slice of BotAppClass.
type BotAppClassArray []BotAppClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsBotApp returns copy with only BotApp constructors.
func ( BotAppClassArray) () ( BotAppArray) {
	for ,  := range  {
		,  := .(*BotApp)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillModifiedMap fills only Modified constructors to given map.
func ( BotAppClassArray) ( map[int64]*BotApp) {
	for ,  := range  {
		,  := .AsModified()
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// ModifiedToMap collects only Modified constructors to map.
func ( BotAppClassArray) () map[int64]*BotApp {
	 := make(map[int64]*BotApp, len())
	.FillModifiedMap()
	return 
}

// AppendOnlyModified appends only Modified constructors to
// given slice.
func ( BotAppClassArray) ( []*BotApp) []*BotApp {
	for ,  := range  {
		,  := .AsModified()
		if ! {
			continue
		}
		 = append(, )
	}

	return 
}

// AsModified returns copy with only Modified constructors.
func ( BotAppClassArray) () ( []*BotApp) {
	return .AppendOnlyModified()
}

// FirstAsModified returns first element of slice (if exists).
func ( BotAppClassArray) () ( *BotApp,  bool) {
	,  := .First()
	if ! {
		return
	}
	return .AsModified()
}

// LastAsModified returns last element of slice (if exists).
func ( BotAppClassArray) () ( *BotApp,  bool) {
	,  := .Last()
	if ! {
		return
	}
	return .AsModified()
}

// PopFirstAsModified returns element of slice (if exists).
func ( *BotAppClassArray) () ( *BotApp,  bool) {
	,  := .PopFirst()
	if ! {
		return
	}
	return .AsModified()
}

// PopAsModified returns element of slice (if exists).
func ( *BotAppClassArray) () ( *BotApp,  bool) {
	,  := .Pop()
	if ! {
		return
	}
	return .AsModified()
}

// BotAppArray is adapter for slice of BotApp.
type BotAppArray []BotApp

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// SortByID sorts slice of BotApp by ID.
func ( BotAppArray) () BotAppArray {
	return .Sort(func(,  BotApp) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of BotApp by ID.
func ( BotAppArray) () BotAppArray {
	return .SortStable(func(,  BotApp) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( BotAppArray) ( map[int64]BotApp) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( BotAppArray) () map[int64]BotApp {
	 := make(map[int64]BotApp, len())
	.FillMap()
	return 
}