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

// PhotoClassArray is adapter for slice of PhotoClass.
type PhotoClassArray []PhotoClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

// PhotoEmptyToMap collects only PhotoEmpty constructors to map.
func ( PhotoClassArray) () map[int64]*PhotoEmpty {
	 := make(map[int64]*PhotoEmpty, len())
	.FillPhotoEmptyMap()
	return 
}

// AsPhotoEmpty returns copy with only PhotoEmpty constructors.
func ( PhotoClassArray) () ( PhotoEmptyArray) {
	for ,  := range  {
		,  := .(*PhotoEmpty)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

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

// PhotoToMap collects only Photo constructors to map.
func ( PhotoClassArray) () map[int64]*Photo {
	 := make(map[int64]*Photo, len())
	.FillPhotoMap()
	return 
}

// AsPhoto returns copy with only Photo constructors.
func ( PhotoClassArray) () ( PhotoArray) {
	for ,  := range  {
		,  := .(*Photo)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

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

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

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

	return 
}

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

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

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

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

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

// PhotoEmptyArray is adapter for slice of PhotoEmpty.
type PhotoEmptyArray []PhotoEmpty

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

// PhotoArray is adapter for slice of Photo.
type PhotoArray []Photo

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

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

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