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

// AccountAutoDownloadSettings represents TL type `account.autoDownloadSettings#63cacf26`.
// Media autodownload settings
//
// See https://core.telegram.org/constructor/account.autoDownloadSettings for reference.
type AccountAutoDownloadSettings struct {
	// Low data usage preset
	Low AutoDownloadSettings
	// Medium data usage preset
	Medium AutoDownloadSettings
	// High data usage preset
	High AutoDownloadSettings
}

// AccountAutoDownloadSettingsTypeID is TL type id of AccountAutoDownloadSettings.
const AccountAutoDownloadSettingsTypeID = 0x63cacf26

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

func ( *AccountAutoDownloadSettings) () bool {
	if  == nil {
		return true
	}
	if !(.Low.Zero()) {
		return false
	}
	if !(.Medium.Zero()) {
		return false
	}
	if !(.High.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills AccountAutoDownloadSettings from given interface.
func ( *AccountAutoDownloadSettings) ( interface {
	() ( AutoDownloadSettings)
	() ( AutoDownloadSettings)
	() ( AutoDownloadSettings)
}) {
	.Low = .()
	.Medium = .()
	.High = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountAutoDownloadSettings) () string {
	return "account.autoDownloadSettings"
}

// TypeInfo returns info about TL type.
func ( *AccountAutoDownloadSettings) () tdp.Type {
	 := tdp.Type{
		Name: "account.autoDownloadSettings",
		ID:   AccountAutoDownloadSettingsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Low",
			SchemaName: "low",
		},
		{
			Name:       "Medium",
			SchemaName: "medium",
		},
		{
			Name:       "High",
			SchemaName: "high",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountAutoDownloadSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.autoDownloadSettings#63cacf26 as nil")
	}
	.PutID(AccountAutoDownloadSettingsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountAutoDownloadSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.autoDownloadSettings#63cacf26 as nil")
	}
	if  := .Low.Encode();  != nil {
		return fmt.Errorf("unable to encode account.autoDownloadSettings#63cacf26: field low: %w", )
	}
	if  := .Medium.Encode();  != nil {
		return fmt.Errorf("unable to encode account.autoDownloadSettings#63cacf26: field medium: %w", )
	}
	if  := .High.Encode();  != nil {
		return fmt.Errorf("unable to encode account.autoDownloadSettings#63cacf26: field high: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountAutoDownloadSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.autoDownloadSettings#63cacf26 to nil")
	}
	if  := .ConsumeID(AccountAutoDownloadSettingsTypeID);  != nil {
		return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountAutoDownloadSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.autoDownloadSettings#63cacf26 to nil")
	}
	{
		if  := .Low.Decode();  != nil {
			return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: field low: %w", )
		}
	}
	{
		if  := .Medium.Decode();  != nil {
			return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: field medium: %w", )
		}
	}
	{
		if  := .High.Decode();  != nil {
			return fmt.Errorf("unable to decode account.autoDownloadSettings#63cacf26: field high: %w", )
		}
	}
	return nil
}

// GetLow returns value of Low field.
func ( *AccountAutoDownloadSettings) () ( AutoDownloadSettings) {
	if  == nil {
		return
	}
	return .Low
}

// GetMedium returns value of Medium field.
func ( *AccountAutoDownloadSettings) () ( AutoDownloadSettings) {
	if  == nil {
		return
	}
	return .Medium
}

// GetHigh returns value of High field.
func ( *AccountAutoDownloadSettings) () ( AutoDownloadSettings) {
	if  == nil {
		return
	}
	return .High
}