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

// PrepaidGiveawayClassArray is adapter for slice of PrepaidGiveawayClass.
type PrepaidGiveawayClassArray []PrepaidGiveawayClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

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

// PrepaidGiveawayToMap collects only PrepaidGiveaway constructors to map.
func ( PrepaidGiveawayClassArray) () map[int64]*PrepaidGiveaway {
	 := make(map[int64]*PrepaidGiveaway, len())
	.FillPrepaidGiveawayMap()
	return 
}

// AsPrepaidGiveaway returns copy with only PrepaidGiveaway constructors.
func ( PrepaidGiveawayClassArray) () ( PrepaidGiveawayArray) {
	for ,  := range  {
		,  := .(*PrepaidGiveaway)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

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

// PrepaidStarsGiveawayToMap collects only PrepaidStarsGiveaway constructors to map.
func ( PrepaidGiveawayClassArray) () map[int64]*PrepaidStarsGiveaway {
	 := make(map[int64]*PrepaidStarsGiveaway, len())
	.FillPrepaidStarsGiveawayMap()
	return 
}

// AsPrepaidStarsGiveaway returns copy with only PrepaidStarsGiveaway constructors.
func ( PrepaidGiveawayClassArray) () ( PrepaidStarsGiveawayArray) {
	for ,  := range  {
		,  := .(*PrepaidStarsGiveaway)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// PrepaidGiveawayArray is adapter for slice of PrepaidGiveaway.
type PrepaidGiveawayArray []PrepaidGiveaway

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

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

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

// PrepaidStarsGiveawayArray is adapter for slice of PrepaidStarsGiveaway.
type PrepaidStarsGiveawayArray []PrepaidStarsGiveaway

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

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

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

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

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

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

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