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

// SecureFileClassArray is adapter for slice of SecureFileClass.
type SecureFileClassArray []SecureFileClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsSecureFile returns copy with only SecureFile constructors.
func ( SecureFileClassArray) () ( SecureFileArray) {
	for ,  := range  {
		,  := .(*SecureFile)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillNotEmptyMap fills only NotEmpty constructors to given map.
func ( SecureFileClassArray) ( map[int64]*SecureFile) {
	for ,  := range  {
		,  := .AsNotEmpty()
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// NotEmptyToMap collects only NotEmpty constructors to map.
func ( SecureFileClassArray) () map[int64]*SecureFile {
	 := make(map[int64]*SecureFile, len())
	.FillNotEmptyMap()
	return 
}

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

	return 
}

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

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

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

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

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

// SecureFileArray is adapter for slice of SecureFile.
type SecureFileArray []SecureFile

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

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

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