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

// EncryptedMessageClassArray is adapter for slice of EncryptedMessageClass.
type EncryptedMessageClassArray []EncryptedMessageClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// AsEncryptedMessage returns copy with only EncryptedMessage constructors.
func ( EncryptedMessageClassArray) () ( EncryptedMessageArray) {
	for ,  := range  {
		,  := .(*EncryptedMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsEncryptedMessageService returns copy with only EncryptedMessageService constructors.
func ( EncryptedMessageClassArray) () ( EncryptedMessageServiceArray) {
	for ,  := range  {
		,  := .(*EncryptedMessageService)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// EncryptedMessageArray is adapter for slice of EncryptedMessage.
type EncryptedMessageArray []EncryptedMessage

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// EncryptedMessageServiceArray is adapter for slice of EncryptedMessageService.
type EncryptedMessageServiceArray []EncryptedMessageService

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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