//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"github.com/gotd/td/bin"
	"github.com/gotd/td/tdjson"
	"github.com/gotd/td/tdp"
	"github.com/gotd/td/tgerr"
)

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

// AuthSentCodeTypeClassArray is adapter for slice of AuthSentCodeTypeClass.
type AuthSentCodeTypeClassArray []AuthSentCodeTypeClass

// Sort sorts slice of AuthSentCodeTypeClass.
func (s AuthSentCodeTypeClassArray) Sort(less func(a, b AuthSentCodeTypeClass) bool) AuthSentCodeTypeClassArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeClass.
func (s AuthSentCodeTypeClassArray) SortStable(less func(a, b AuthSentCodeTypeClass) bool) AuthSentCodeTypeClassArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeClass.
func (s AuthSentCodeTypeClassArray) Retain(keep func(x AuthSentCodeTypeClass) bool) AuthSentCodeTypeClassArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeClassArray) First() (v AuthSentCodeTypeClass, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeClassArray) Last() (v AuthSentCodeTypeClass, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AsAuthSentCodeTypeApp returns copy with only AuthSentCodeTypeApp constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeApp() (to AuthSentCodeTypeAppArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeApp)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeSMS returns copy with only AuthSentCodeTypeSMS constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeSMS() (to AuthSentCodeTypeSMSArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeSMS)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeCall returns copy with only AuthSentCodeTypeCall constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeCall() (to AuthSentCodeTypeCallArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeFlashCall returns copy with only AuthSentCodeTypeFlashCall constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeFlashCall() (to AuthSentCodeTypeFlashCallArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeFlashCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeMissedCall returns copy with only AuthSentCodeTypeMissedCall constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeMissedCall() (to AuthSentCodeTypeMissedCallArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeMissedCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeEmailCode returns copy with only AuthSentCodeTypeEmailCode constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeEmailCode() (to AuthSentCodeTypeEmailCodeArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeEmailCode)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeSetUpEmailRequired returns copy with only AuthSentCodeTypeSetUpEmailRequired constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeSetUpEmailRequired() (to AuthSentCodeTypeSetUpEmailRequiredArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeSetUpEmailRequired)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeFragmentSMS returns copy with only AuthSentCodeTypeFragmentSMS constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeFragmentSMS() (to AuthSentCodeTypeFragmentSMSArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeFragmentSMS)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsAuthSentCodeTypeFirebaseSMS returns copy with only AuthSentCodeTypeFirebaseSMS constructors.
func (s AuthSentCodeTypeClassArray) AsAuthSentCodeTypeFirebaseSMS() (to AuthSentCodeTypeFirebaseSMSArray) {
	for _, elem := range s {
		value, ok := elem.(*AuthSentCodeTypeFirebaseSMS)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AuthSentCodeTypeAppArray is adapter for slice of AuthSentCodeTypeApp.
type AuthSentCodeTypeAppArray []AuthSentCodeTypeApp

// Sort sorts slice of AuthSentCodeTypeApp.
func (s AuthSentCodeTypeAppArray) Sort(less func(a, b AuthSentCodeTypeApp) bool) AuthSentCodeTypeAppArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeApp.
func (s AuthSentCodeTypeAppArray) SortStable(less func(a, b AuthSentCodeTypeApp) bool) AuthSentCodeTypeAppArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeApp.
func (s AuthSentCodeTypeAppArray) Retain(keep func(x AuthSentCodeTypeApp) bool) AuthSentCodeTypeAppArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeAppArray) First() (v AuthSentCodeTypeApp, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeAppArray) Last() (v AuthSentCodeTypeApp, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeSMSArray is adapter for slice of AuthSentCodeTypeSMS.
type AuthSentCodeTypeSMSArray []AuthSentCodeTypeSMS

// Sort sorts slice of AuthSentCodeTypeSMS.
func (s AuthSentCodeTypeSMSArray) Sort(less func(a, b AuthSentCodeTypeSMS) bool) AuthSentCodeTypeSMSArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeSMS.
func (s AuthSentCodeTypeSMSArray) SortStable(less func(a, b AuthSentCodeTypeSMS) bool) AuthSentCodeTypeSMSArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeSMS.
func (s AuthSentCodeTypeSMSArray) Retain(keep func(x AuthSentCodeTypeSMS) bool) AuthSentCodeTypeSMSArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeSMSArray) First() (v AuthSentCodeTypeSMS, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeSMSArray) Last() (v AuthSentCodeTypeSMS, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeCallArray is adapter for slice of AuthSentCodeTypeCall.
type AuthSentCodeTypeCallArray []AuthSentCodeTypeCall

// Sort sorts slice of AuthSentCodeTypeCall.
func (s AuthSentCodeTypeCallArray) Sort(less func(a, b AuthSentCodeTypeCall) bool) AuthSentCodeTypeCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeCall.
func (s AuthSentCodeTypeCallArray) SortStable(less func(a, b AuthSentCodeTypeCall) bool) AuthSentCodeTypeCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeCall.
func (s AuthSentCodeTypeCallArray) Retain(keep func(x AuthSentCodeTypeCall) bool) AuthSentCodeTypeCallArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeCallArray) First() (v AuthSentCodeTypeCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeCallArray) Last() (v AuthSentCodeTypeCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeFlashCallArray is adapter for slice of AuthSentCodeTypeFlashCall.
type AuthSentCodeTypeFlashCallArray []AuthSentCodeTypeFlashCall

// Sort sorts slice of AuthSentCodeTypeFlashCall.
func (s AuthSentCodeTypeFlashCallArray) Sort(less func(a, b AuthSentCodeTypeFlashCall) bool) AuthSentCodeTypeFlashCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeFlashCall.
func (s AuthSentCodeTypeFlashCallArray) SortStable(less func(a, b AuthSentCodeTypeFlashCall) bool) AuthSentCodeTypeFlashCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeFlashCall.
func (s AuthSentCodeTypeFlashCallArray) Retain(keep func(x AuthSentCodeTypeFlashCall) bool) AuthSentCodeTypeFlashCallArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeFlashCallArray) First() (v AuthSentCodeTypeFlashCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeFlashCallArray) Last() (v AuthSentCodeTypeFlashCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeMissedCallArray is adapter for slice of AuthSentCodeTypeMissedCall.
type AuthSentCodeTypeMissedCallArray []AuthSentCodeTypeMissedCall

// Sort sorts slice of AuthSentCodeTypeMissedCall.
func (s AuthSentCodeTypeMissedCallArray) Sort(less func(a, b AuthSentCodeTypeMissedCall) bool) AuthSentCodeTypeMissedCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeMissedCall.
func (s AuthSentCodeTypeMissedCallArray) SortStable(less func(a, b AuthSentCodeTypeMissedCall) bool) AuthSentCodeTypeMissedCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeMissedCall.
func (s AuthSentCodeTypeMissedCallArray) Retain(keep func(x AuthSentCodeTypeMissedCall) bool) AuthSentCodeTypeMissedCallArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeMissedCallArray) First() (v AuthSentCodeTypeMissedCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeMissedCallArray) Last() (v AuthSentCodeTypeMissedCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeEmailCodeArray is adapter for slice of AuthSentCodeTypeEmailCode.
type AuthSentCodeTypeEmailCodeArray []AuthSentCodeTypeEmailCode

// Sort sorts slice of AuthSentCodeTypeEmailCode.
func (s AuthSentCodeTypeEmailCodeArray) Sort(less func(a, b AuthSentCodeTypeEmailCode) bool) AuthSentCodeTypeEmailCodeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeEmailCode.
func (s AuthSentCodeTypeEmailCodeArray) SortStable(less func(a, b AuthSentCodeTypeEmailCode) bool) AuthSentCodeTypeEmailCodeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeEmailCode.
func (s AuthSentCodeTypeEmailCodeArray) Retain(keep func(x AuthSentCodeTypeEmailCode) bool) AuthSentCodeTypeEmailCodeArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeEmailCodeArray) First() (v AuthSentCodeTypeEmailCode, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeEmailCodeArray) Last() (v AuthSentCodeTypeEmailCode, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeSetUpEmailRequiredArray is adapter for slice of AuthSentCodeTypeSetUpEmailRequired.
type AuthSentCodeTypeSetUpEmailRequiredArray []AuthSentCodeTypeSetUpEmailRequired

// Sort sorts slice of AuthSentCodeTypeSetUpEmailRequired.
func (s AuthSentCodeTypeSetUpEmailRequiredArray) Sort(less func(a, b AuthSentCodeTypeSetUpEmailRequired) bool) AuthSentCodeTypeSetUpEmailRequiredArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeSetUpEmailRequired.
func (s AuthSentCodeTypeSetUpEmailRequiredArray) SortStable(less func(a, b AuthSentCodeTypeSetUpEmailRequired) bool) AuthSentCodeTypeSetUpEmailRequiredArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeSetUpEmailRequired.
func (s AuthSentCodeTypeSetUpEmailRequiredArray) Retain(keep func(x AuthSentCodeTypeSetUpEmailRequired) bool) AuthSentCodeTypeSetUpEmailRequiredArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeSetUpEmailRequiredArray) First() (v AuthSentCodeTypeSetUpEmailRequired, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeSetUpEmailRequiredArray) Last() (v AuthSentCodeTypeSetUpEmailRequired, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeFragmentSMSArray is adapter for slice of AuthSentCodeTypeFragmentSMS.
type AuthSentCodeTypeFragmentSMSArray []AuthSentCodeTypeFragmentSMS

// Sort sorts slice of AuthSentCodeTypeFragmentSMS.
func (s AuthSentCodeTypeFragmentSMSArray) Sort(less func(a, b AuthSentCodeTypeFragmentSMS) bool) AuthSentCodeTypeFragmentSMSArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeFragmentSMS.
func (s AuthSentCodeTypeFragmentSMSArray) SortStable(less func(a, b AuthSentCodeTypeFragmentSMS) bool) AuthSentCodeTypeFragmentSMSArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeFragmentSMS.
func (s AuthSentCodeTypeFragmentSMSArray) Retain(keep func(x AuthSentCodeTypeFragmentSMS) bool) AuthSentCodeTypeFragmentSMSArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeFragmentSMSArray) First() (v AuthSentCodeTypeFragmentSMS, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeFragmentSMSArray) Last() (v AuthSentCodeTypeFragmentSMS, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}

// AuthSentCodeTypeFirebaseSMSArray is adapter for slice of AuthSentCodeTypeFirebaseSMS.
type AuthSentCodeTypeFirebaseSMSArray []AuthSentCodeTypeFirebaseSMS

// Sort sorts slice of AuthSentCodeTypeFirebaseSMS.
func (s AuthSentCodeTypeFirebaseSMSArray) Sort(less func(a, b AuthSentCodeTypeFirebaseSMS) bool) AuthSentCodeTypeFirebaseSMSArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of AuthSentCodeTypeFirebaseSMS.
func (s AuthSentCodeTypeFirebaseSMSArray) SortStable(less func(a, b AuthSentCodeTypeFirebaseSMS) bool) AuthSentCodeTypeFirebaseSMSArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of AuthSentCodeTypeFirebaseSMS.
func (s AuthSentCodeTypeFirebaseSMSArray) Retain(keep func(x AuthSentCodeTypeFirebaseSMS) bool) AuthSentCodeTypeFirebaseSMSArray {
	n := 0
	for _, x := range s {
		if keep(x) {
			s[n] = x
			n++
		}
	}
	s = s[:n]

	return s
}

// First returns first element of slice (if exists).
func (s AuthSentCodeTypeFirebaseSMSArray) First() (v AuthSentCodeTypeFirebaseSMS, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s AuthSentCodeTypeFirebaseSMSArray) Last() (v AuthSentCodeTypeFirebaseSMS, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[len(s)-1], true
}

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

	a := *s
	v = a[0]

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

	return v, true
}

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

	a := *s
	v = a[len(a)-1]
	a = a[:len(a)-1]
	*s = a

	return v, true
}
