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

// DraftMessageClassArray is adapter for slice of DraftMessageClass.
type DraftMessageClassArray []DraftMessageClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsDraftMessageEmpty returns copy with only DraftMessageEmpty constructors.
func ( DraftMessageClassArray) () ( DraftMessageEmptyArray) {
	for ,  := range  {
		,  := .(*DraftMessageEmpty)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsDraftMessage returns copy with only DraftMessage constructors.
func ( DraftMessageClassArray) () ( DraftMessageArray) {
	for ,  := range  {
		,  := .(*DraftMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AppendOnlyNotEmpty appends only NotEmpty constructors to
// given slice.
func ( DraftMessageClassArray) ( []*DraftMessage) []*DraftMessage {
	for ,  := range  {
		,  := .AsNotEmpty()
		if ! {
			continue
		}
		 = append(, )
	}

	return 
}

// AsNotEmpty returns copy with only NotEmpty constructors.
func ( DraftMessageClassArray) () ( []*DraftMessage) {
	return .AppendOnlyNotEmpty()
}

// FirstAsNotEmpty returns first element of slice (if exists).
func ( DraftMessageClassArray) () ( *DraftMessage,  bool) {
	,  := .First()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// LastAsNotEmpty returns last element of slice (if exists).
func ( DraftMessageClassArray) () ( *DraftMessage,  bool) {
	,  := .Last()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// PopFirstAsNotEmpty returns element of slice (if exists).
func ( *DraftMessageClassArray) () ( *DraftMessage,  bool) {
	,  := .PopFirst()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// PopAsNotEmpty returns element of slice (if exists).
func ( *DraftMessageClassArray) () ( *DraftMessage,  bool) {
	,  := .Pop()
	if ! {
		return
	}
	return .AsNotEmpty()
}

// DraftMessageEmptyArray is adapter for slice of DraftMessageEmpty.
type DraftMessageEmptyArray []DraftMessageEmpty

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// DraftMessageArray is adapter for slice of DraftMessage.
type DraftMessageArray []DraftMessage

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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