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

// StoryItemClassArray is adapter for slice of StoryItemClass.
type StoryItemClassArray []StoryItemClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// FillStoryItemDeletedMap fills only StoryItemDeleted constructors to given map.
func ( StoryItemClassArray) ( map[int]*StoryItemDeleted) {
	for ,  := range  {
		,  := .(*StoryItemDeleted)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// StoryItemDeletedToMap collects only StoryItemDeleted constructors to map.
func ( StoryItemClassArray) () map[int]*StoryItemDeleted {
	 := make(map[int]*StoryItemDeleted, len())
	.FillStoryItemDeletedMap()
	return 
}

// AsStoryItemDeleted returns copy with only StoryItemDeleted constructors.
func ( StoryItemClassArray) () ( StoryItemDeletedArray) {
	for ,  := range  {
		,  := .(*StoryItemDeleted)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillStoryItemSkippedMap fills only StoryItemSkipped constructors to given map.
func ( StoryItemClassArray) ( map[int]*StoryItemSkipped) {
	for ,  := range  {
		,  := .(*StoryItemSkipped)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// StoryItemSkippedToMap collects only StoryItemSkipped constructors to map.
func ( StoryItemClassArray) () map[int]*StoryItemSkipped {
	 := make(map[int]*StoryItemSkipped, len())
	.FillStoryItemSkippedMap()
	return 
}

// AsStoryItemSkipped returns copy with only StoryItemSkipped constructors.
func ( StoryItemClassArray) () ( StoryItemSkippedArray) {
	for ,  := range  {
		,  := .(*StoryItemSkipped)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillStoryItemMap fills only StoryItem constructors to given map.
func ( StoryItemClassArray) ( map[int]*StoryItem) {
	for ,  := range  {
		,  := .(*StoryItem)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// StoryItemToMap collects only StoryItem constructors to map.
func ( StoryItemClassArray) () map[int]*StoryItem {
	 := make(map[int]*StoryItem, len())
	.FillStoryItemMap()
	return 
}

// AsStoryItem returns copy with only StoryItem constructors.
func ( StoryItemClassArray) () ( StoryItemArray) {
	for ,  := range  {
		,  := .(*StoryItem)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// StoryItemDeletedArray is adapter for slice of StoryItemDeleted.
type StoryItemDeletedArray []StoryItemDeleted

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

// FillMap fills constructors to given map.
func ( StoryItemDeletedArray) ( map[int]StoryItemDeleted) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( StoryItemDeletedArray) () map[int]StoryItemDeleted {
	 := make(map[int]StoryItemDeleted, len())
	.FillMap()
	return 
}

// StoryItemSkippedArray is adapter for slice of StoryItemSkipped.
type StoryItemSkippedArray []StoryItemSkipped

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

// FillMap fills constructors to given map.
func ( StoryItemSkippedArray) ( map[int]StoryItemSkipped) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( StoryItemSkippedArray) () map[int]StoryItemSkipped {
	 := make(map[int]StoryItemSkipped, len())
	.FillMap()
	return 
}

// StoryItemArray is adapter for slice of StoryItem.
type StoryItemArray []StoryItem

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

// FillMap fills constructors to given map.
func ( StoryItemArray) ( map[int]StoryItem) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( StoryItemArray) () map[int]StoryItem {
	 := make(map[int]StoryItem, len())
	.FillMap()
	return 
}