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

// GroupCallClassArray is adapter for slice of GroupCallClass.
type GroupCallClassArray []GroupCallClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// FillGroupCallDiscardedMap fills only GroupCallDiscarded constructors to given map.
func ( GroupCallClassArray) ( map[int64]*GroupCallDiscarded) {
	for ,  := range  {
		,  := .(*GroupCallDiscarded)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// GroupCallDiscardedToMap collects only GroupCallDiscarded constructors to map.
func ( GroupCallClassArray) () map[int64]*GroupCallDiscarded {
	 := make(map[int64]*GroupCallDiscarded, len())
	.FillGroupCallDiscardedMap()
	return 
}

// AsGroupCallDiscarded returns copy with only GroupCallDiscarded constructors.
func ( GroupCallClassArray) () ( GroupCallDiscardedArray) {
	for ,  := range  {
		,  := .(*GroupCallDiscarded)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillGroupCallMap fills only GroupCall constructors to given map.
func ( GroupCallClassArray) ( map[int64]*GroupCall) {
	for ,  := range  {
		,  := .(*GroupCall)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// GroupCallToMap collects only GroupCall constructors to map.
func ( GroupCallClassArray) () map[int64]*GroupCall {
	 := make(map[int64]*GroupCall, len())
	.FillGroupCallMap()
	return 
}

// AsGroupCall returns copy with only GroupCall constructors.
func ( GroupCallClassArray) () ( GroupCallArray) {
	for ,  := range  {
		,  := .(*GroupCall)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// GroupCallDiscardedArray is adapter for slice of GroupCallDiscarded.
type GroupCallDiscardedArray []GroupCallDiscarded

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

// GroupCallArray is adapter for slice of GroupCall.
type GroupCallArray []GroupCall

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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