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

// NotificationSoundClassArray is adapter for slice of NotificationSoundClass.
type NotificationSoundClassArray []NotificationSoundClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsNotificationSoundLocal returns copy with only NotificationSoundLocal constructors.
func ( NotificationSoundClassArray) () ( NotificationSoundLocalArray) {
	for ,  := range  {
		,  := .(*NotificationSoundLocal)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsNotificationSoundRingtone returns copy with only NotificationSoundRingtone constructors.
func ( NotificationSoundClassArray) () ( NotificationSoundRingtoneArray) {
	for ,  := range  {
		,  := .(*NotificationSoundRingtone)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// NotificationSoundLocalArray is adapter for slice of NotificationSoundLocal.
type NotificationSoundLocalArray []NotificationSoundLocal

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// NotificationSoundRingtoneArray is adapter for slice of NotificationSoundRingtone.
type NotificationSoundRingtoneArray []NotificationSoundRingtone

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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