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

// NotificationSoundDefault represents TL type `notificationSoundDefault#97e8bebe`.
// Indicates the default notification sound should be used
//
// See https://core.telegram.org/constructor/notificationSoundDefault for reference.
type NotificationSoundDefault struct {
}

// NotificationSoundDefaultTypeID is TL type id of NotificationSoundDefault.
const NotificationSoundDefaultTypeID = 0x97e8bebe

// construct implements constructor of NotificationSoundClass.
func ( NotificationSoundDefault) () NotificationSoundClass { return & }

// Ensuring interfaces in compile-time for NotificationSoundDefault.
var (
	_ bin.Encoder     = &NotificationSoundDefault{}
	_ bin.Decoder     = &NotificationSoundDefault{}
	_ bin.BareEncoder = &NotificationSoundDefault{}
	_ bin.BareDecoder = &NotificationSoundDefault{}

	_ NotificationSoundClass = &NotificationSoundDefault{}
)

func ( *NotificationSoundDefault) () bool {
	if  == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func ( *NotificationSoundDefault) () string {
	if  == nil {
		return "NotificationSoundDefault(nil)"
	}
	type  NotificationSoundDefault
	return fmt.Sprintf("NotificationSoundDefault%+v", (*))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*NotificationSoundDefault) () uint32 {
	return NotificationSoundDefaultTypeID
}

// TypeName returns name of type in TL schema.
func (*NotificationSoundDefault) () string {
	return "notificationSoundDefault"
}

// TypeInfo returns info about TL type.
func ( *NotificationSoundDefault) () tdp.Type {
	 := tdp.Type{
		Name: "notificationSoundDefault",
		ID:   NotificationSoundDefaultTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *NotificationSoundDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundDefault#97e8bebe as nil")
	}
	.PutID(NotificationSoundDefaultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *NotificationSoundDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundDefault#97e8bebe as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *NotificationSoundDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundDefault#97e8bebe to nil")
	}
	if  := .ConsumeID(NotificationSoundDefaultTypeID);  != nil {
		return fmt.Errorf("unable to decode notificationSoundDefault#97e8bebe: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *NotificationSoundDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundDefault#97e8bebe to nil")
	}
	return nil
}

// NotificationSoundNone represents TL type `notificationSoundNone#6f0c34df`.
// No notification sound should be used
//
// See https://core.telegram.org/constructor/notificationSoundNone for reference.
type NotificationSoundNone struct {
}

// NotificationSoundNoneTypeID is TL type id of NotificationSoundNone.
const NotificationSoundNoneTypeID = 0x6f0c34df

// construct implements constructor of NotificationSoundClass.
func ( NotificationSoundNone) () NotificationSoundClass { return & }

// Ensuring interfaces in compile-time for NotificationSoundNone.
var (
	_ bin.Encoder     = &NotificationSoundNone{}
	_ bin.Decoder     = &NotificationSoundNone{}
	_ bin.BareEncoder = &NotificationSoundNone{}
	_ bin.BareDecoder = &NotificationSoundNone{}

	_ NotificationSoundClass = &NotificationSoundNone{}
)

func ( *NotificationSoundNone) () bool {
	if  == nil {
		return true
	}

	return true
}

// String implements fmt.Stringer.
func ( *NotificationSoundNone) () string {
	if  == nil {
		return "NotificationSoundNone(nil)"
	}
	type  NotificationSoundNone
	return fmt.Sprintf("NotificationSoundNone%+v", (*))
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*NotificationSoundNone) () uint32 {
	return NotificationSoundNoneTypeID
}

// TypeName returns name of type in TL schema.
func (*NotificationSoundNone) () string {
	return "notificationSoundNone"
}

// TypeInfo returns info about TL type.
func ( *NotificationSoundNone) () tdp.Type {
	 := tdp.Type{
		Name: "notificationSoundNone",
		ID:   NotificationSoundNoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *NotificationSoundNone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundNone#6f0c34df as nil")
	}
	.PutID(NotificationSoundNoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *NotificationSoundNone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundNone#6f0c34df as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *NotificationSoundNone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundNone#6f0c34df to nil")
	}
	if  := .ConsumeID(NotificationSoundNoneTypeID);  != nil {
		return fmt.Errorf("unable to decode notificationSoundNone#6f0c34df: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *NotificationSoundNone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundNone#6f0c34df to nil")
	}
	return nil
}

// NotificationSoundLocal represents TL type `notificationSoundLocal#830b9ae4`.
// Indicates a specific local notification sound should be used
//
// See https://core.telegram.org/constructor/notificationSoundLocal for reference.
type NotificationSoundLocal struct {
	// Notification sound title
	Title string
	// Notification sound identifier (arbitrary data used by the client to identify a
	// specific local notification sound)
	Data string
}

// NotificationSoundLocalTypeID is TL type id of NotificationSoundLocal.
const NotificationSoundLocalTypeID = 0x830b9ae4

// construct implements constructor of NotificationSoundClass.
func ( NotificationSoundLocal) () NotificationSoundClass { return & }

// Ensuring interfaces in compile-time for NotificationSoundLocal.
var (
	_ bin.Encoder     = &NotificationSoundLocal{}
	_ bin.Decoder     = &NotificationSoundLocal{}
	_ bin.BareEncoder = &NotificationSoundLocal{}
	_ bin.BareDecoder = &NotificationSoundLocal{}

	_ NotificationSoundClass = &NotificationSoundLocal{}
)

func ( *NotificationSoundLocal) () bool {
	if  == nil {
		return true
	}
	if !(.Title == "") {
		return false
	}
	if !(.Data == "") {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *NotificationSoundLocal) () string {
	if  == nil {
		return "NotificationSoundLocal(nil)"
	}
	type  NotificationSoundLocal
	return fmt.Sprintf("NotificationSoundLocal%+v", (*))
}

// FillFrom fills NotificationSoundLocal from given interface.
func ( *NotificationSoundLocal) ( interface {
	() ( string)
	() ( string)
}) {
	.Title = .()
	.Data = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*NotificationSoundLocal) () uint32 {
	return NotificationSoundLocalTypeID
}

// TypeName returns name of type in TL schema.
func (*NotificationSoundLocal) () string {
	return "notificationSoundLocal"
}

// TypeInfo returns info about TL type.
func ( *NotificationSoundLocal) () tdp.Type {
	 := tdp.Type{
		Name: "notificationSoundLocal",
		ID:   NotificationSoundLocalTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Data",
			SchemaName: "data",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *NotificationSoundLocal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundLocal#830b9ae4 as nil")
	}
	.PutID(NotificationSoundLocalTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *NotificationSoundLocal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundLocal#830b9ae4 as nil")
	}
	.PutString(.Title)
	.PutString(.Data)
	return nil
}

// Decode implements bin.Decoder.
func ( *NotificationSoundLocal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundLocal#830b9ae4 to nil")
	}
	if  := .ConsumeID(NotificationSoundLocalTypeID);  != nil {
		return fmt.Errorf("unable to decode notificationSoundLocal#830b9ae4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *NotificationSoundLocal) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundLocal#830b9ae4 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode notificationSoundLocal#830b9ae4: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode notificationSoundLocal#830b9ae4: field data: %w", )
		}
		.Data = 
	}
	return nil
}

// GetTitle returns value of Title field.
func ( *NotificationSoundLocal) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// GetData returns value of Data field.
func ( *NotificationSoundLocal) () ( string) {
	if  == nil {
		return
	}
	return .Data
}

// NotificationSoundRingtone represents TL type `notificationSoundRingtone#ff6c8049`.
// A specific previously uploaded notification sound should be used
//
// See https://core.telegram.org/constructor/notificationSoundRingtone for reference.
type NotificationSoundRingtone struct {
	// Document ID of notification sound uploaded using account.uploadRingtoneĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/method/account.uploadRingtone
	ID int64
}

// NotificationSoundRingtoneTypeID is TL type id of NotificationSoundRingtone.
const NotificationSoundRingtoneTypeID = 0xff6c8049

// construct implements constructor of NotificationSoundClass.
func ( NotificationSoundRingtone) () NotificationSoundClass { return & }

// Ensuring interfaces in compile-time for NotificationSoundRingtone.
var (
	_ bin.Encoder     = &NotificationSoundRingtone{}
	_ bin.Decoder     = &NotificationSoundRingtone{}
	_ bin.BareEncoder = &NotificationSoundRingtone{}
	_ bin.BareDecoder = &NotificationSoundRingtone{}

	_ NotificationSoundClass = &NotificationSoundRingtone{}
)

func ( *NotificationSoundRingtone) () bool {
	if  == nil {
		return true
	}
	if !(.ID == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *NotificationSoundRingtone) () string {
	if  == nil {
		return "NotificationSoundRingtone(nil)"
	}
	type  NotificationSoundRingtone
	return fmt.Sprintf("NotificationSoundRingtone%+v", (*))
}

// FillFrom fills NotificationSoundRingtone from given interface.
func ( *NotificationSoundRingtone) ( interface {
	() ( int64)
}) {
	.ID = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*NotificationSoundRingtone) () uint32 {
	return NotificationSoundRingtoneTypeID
}

// TypeName returns name of type in TL schema.
func (*NotificationSoundRingtone) () string {
	return "notificationSoundRingtone"
}

// TypeInfo returns info about TL type.
func ( *NotificationSoundRingtone) () tdp.Type {
	 := tdp.Type{
		Name: "notificationSoundRingtone",
		ID:   NotificationSoundRingtoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *NotificationSoundRingtone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundRingtone#ff6c8049 as nil")
	}
	.PutID(NotificationSoundRingtoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *NotificationSoundRingtone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode notificationSoundRingtone#ff6c8049 as nil")
	}
	.PutLong(.ID)
	return nil
}

// Decode implements bin.Decoder.
func ( *NotificationSoundRingtone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundRingtone#ff6c8049 to nil")
	}
	if  := .ConsumeID(NotificationSoundRingtoneTypeID);  != nil {
		return fmt.Errorf("unable to decode notificationSoundRingtone#ff6c8049: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *NotificationSoundRingtone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode notificationSoundRingtone#ff6c8049 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode notificationSoundRingtone#ff6c8049: field id: %w", )
		}
		.ID = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *NotificationSoundRingtone) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}

// NotificationSoundClassName is schema name of NotificationSoundClass.
const NotificationSoundClassName = "NotificationSound"

// NotificationSoundClass represents NotificationSound generic type.
//
// See https://core.telegram.org/type/NotificationSound for reference.
//
// Example:
//
//	g, err := tg.DecodeNotificationSound(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.NotificationSoundDefault: // notificationSoundDefault#97e8bebe
//	case *tg.NotificationSoundNone: // notificationSoundNone#6f0c34df
//	case *tg.NotificationSoundLocal: // notificationSoundLocal#830b9ae4
//	case *tg.NotificationSoundRingtone: // notificationSoundRingtone#ff6c8049
//	default: panic(v)
//	}
type NotificationSoundClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() NotificationSoundClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeNotificationSound implements binary de-serialization for NotificationSoundClass.
func ( *bin.Buffer) (NotificationSoundClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case NotificationSoundDefaultTypeID:
		// Decoding notificationSoundDefault#97e8bebe.
		 := NotificationSoundDefault{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode NotificationSoundClass: %w", )
		}
		return &, nil
	case NotificationSoundNoneTypeID:
		// Decoding notificationSoundNone#6f0c34df.
		 := NotificationSoundNone{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode NotificationSoundClass: %w", )
		}
		return &, nil
	case NotificationSoundLocalTypeID:
		// Decoding notificationSoundLocal#830b9ae4.
		 := NotificationSoundLocal{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode NotificationSoundClass: %w", )
		}
		return &, nil
	case NotificationSoundRingtoneTypeID:
		// Decoding notificationSoundRingtone#ff6c8049.
		 := NotificationSoundRingtone{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode NotificationSoundClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode NotificationSoundClass: %w", bin.NewUnexpectedID())
	}
}

// NotificationSound boxes the NotificationSoundClass providing a helper.
type NotificationSoundBox struct {
	NotificationSound NotificationSoundClass
}

// Decode implements bin.Decoder for NotificationSoundBox.
func ( *NotificationSoundBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode NotificationSoundBox to nil")
	}
	,  := DecodeNotificationSound()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.NotificationSound = 
	return nil
}

// Encode implements bin.Encode for NotificationSoundBox.
func ( *NotificationSoundBox) ( *bin.Buffer) error {
	if  == nil || .NotificationSound == nil {
		return fmt.Errorf("unable to encode NotificationSoundClass as nil")
	}
	return .NotificationSound.Encode()
}