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

// AccountDaysTTL represents TL type `accountDaysTTL#b8d0afdf`.
// Time to live in days of the current account
//
// See https://core.telegram.org/constructor/accountDaysTTL for reference.
type AccountDaysTTL struct {
	// This account will self-destruct in the specified number of days
	Days int
}

// AccountDaysTTLTypeID is TL type id of AccountDaysTTL.
const AccountDaysTTLTypeID = 0xb8d0afdf

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

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

	return true
}

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

// FillFrom fills AccountDaysTTL from given interface.
func ( *AccountDaysTTL) ( interface {
	() ( int)
}) {
	.Days = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountDaysTTL) () tdp.Type {
	 := tdp.Type{
		Name: "accountDaysTTL",
		ID:   AccountDaysTTLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Days",
			SchemaName: "days",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountDaysTTL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode accountDaysTTL#b8d0afdf as nil")
	}
	.PutID(AccountDaysTTLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountDaysTTL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode accountDaysTTL#b8d0afdf as nil")
	}
	.PutInt(.Days)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountDaysTTL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode accountDaysTTL#b8d0afdf to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode accountDaysTTL#b8d0afdf: field days: %w", )
		}
		.Days = 
	}
	return nil
}

// GetDays returns value of Days field.
func ( *AccountDaysTTL) () ( int) {
	if  == nil {
		return
	}
	return .Days
}