// Code generated by gotdgen, DO NOT EDIT.

package mt

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

// MsgDetailedInfo represents TL type `msg_detailed_info#276d3ec6`.
type MsgDetailedInfo struct {
	// MsgID field of MsgDetailedInfo.
	MsgID int64
	// AnswerMsgID field of MsgDetailedInfo.
	AnswerMsgID int64
	// Bytes field of MsgDetailedInfo.
	Bytes int
	// Status field of MsgDetailedInfo.
	Status int
}

// MsgDetailedInfoTypeID is TL type id of MsgDetailedInfo.
const MsgDetailedInfoTypeID = 0x276d3ec6

// construct implements constructor of MsgDetailedInfoClass.
func ( MsgDetailedInfo) () MsgDetailedInfoClass { return & }

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

	_ MsgDetailedInfoClass = &MsgDetailedInfo{}
)

func ( *MsgDetailedInfo) () bool {
	if  == nil {
		return true
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.AnswerMsgID == 0) {
		return false
	}
	if !(.Bytes == 0) {
		return false
	}
	if !(.Status == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *MsgDetailedInfo) () tdp.Type {
	 := tdp.Type{
		Name: "msg_detailed_info",
		ID:   MsgDetailedInfoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "AnswerMsgID",
			SchemaName: "answer_msg_id",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
		{
			Name:       "Status",
			SchemaName: "status",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MsgDetailedInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode msg_detailed_info#276d3ec6 as nil")
	}
	.PutID(MsgDetailedInfoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MsgDetailedInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode msg_detailed_info#276d3ec6 as nil")
	}
	.PutLong(.MsgID)
	.PutLong(.AnswerMsgID)
	.PutInt(.Bytes)
	.PutInt(.Status)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MsgDetailedInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode msg_detailed_info#276d3ec6 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field msg_id: %w", )
		}
		.MsgID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field answer_msg_id: %w", )
		}
		.AnswerMsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field bytes: %w", )
		}
		.Bytes = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode msg_detailed_info#276d3ec6: field status: %w", )
		}
		.Status = 
	}
	return nil
}

// GetMsgID returns value of MsgID field.
func ( *MsgDetailedInfo) () ( int64) {
	if  == nil {
		return
	}
	return .MsgID
}

// GetAnswerMsgID returns value of AnswerMsgID field.
func ( *MsgDetailedInfo) () ( int64) {
	if  == nil {
		return
	}
	return .AnswerMsgID
}

// GetBytes returns value of Bytes field.
func ( *MsgDetailedInfo) () ( int) {
	if  == nil {
		return
	}
	return .Bytes
}

// GetStatus returns value of Status field.
func ( *MsgDetailedInfo) () ( int) {
	if  == nil {
		return
	}
	return .Status
}

// MsgNewDetailedInfo represents TL type `msg_new_detailed_info#809db6df`.
type MsgNewDetailedInfo struct {
	// AnswerMsgID field of MsgNewDetailedInfo.
	AnswerMsgID int64
	// Bytes field of MsgNewDetailedInfo.
	Bytes int
	// Status field of MsgNewDetailedInfo.
	Status int
}

// MsgNewDetailedInfoTypeID is TL type id of MsgNewDetailedInfo.
const MsgNewDetailedInfoTypeID = 0x809db6df

// construct implements constructor of MsgDetailedInfoClass.
func ( MsgNewDetailedInfo) () MsgDetailedInfoClass { return & }

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

	_ MsgDetailedInfoClass = &MsgNewDetailedInfo{}
)

func ( *MsgNewDetailedInfo) () bool {
	if  == nil {
		return true
	}
	if !(.AnswerMsgID == 0) {
		return false
	}
	if !(.Bytes == 0) {
		return false
	}
	if !(.Status == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *MsgNewDetailedInfo) () tdp.Type {
	 := tdp.Type{
		Name: "msg_new_detailed_info",
		ID:   MsgNewDetailedInfoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "AnswerMsgID",
			SchemaName: "answer_msg_id",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
		{
			Name:       "Status",
			SchemaName: "status",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MsgNewDetailedInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode msg_new_detailed_info#809db6df as nil")
	}
	.PutID(MsgNewDetailedInfoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MsgNewDetailedInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode msg_new_detailed_info#809db6df as nil")
	}
	.PutLong(.AnswerMsgID)
	.PutInt(.Bytes)
	.PutInt(.Status)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MsgNewDetailedInfo) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode msg_new_detailed_info#809db6df to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: field answer_msg_id: %w", )
		}
		.AnswerMsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: field bytes: %w", )
		}
		.Bytes = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode msg_new_detailed_info#809db6df: field status: %w", )
		}
		.Status = 
	}
	return nil
}

// GetAnswerMsgID returns value of AnswerMsgID field.
func ( *MsgNewDetailedInfo) () ( int64) {
	if  == nil {
		return
	}
	return .AnswerMsgID
}

// GetBytes returns value of Bytes field.
func ( *MsgNewDetailedInfo) () ( int) {
	if  == nil {
		return
	}
	return .Bytes
}

// GetStatus returns value of Status field.
func ( *MsgNewDetailedInfo) () ( int) {
	if  == nil {
		return
	}
	return .Status
}

// MsgDetailedInfoClassName is schema name of MsgDetailedInfoClass.
const MsgDetailedInfoClassName = "MsgDetailedInfo"

// MsgDetailedInfoClass represents MsgDetailedInfo generic type.
//
// Example:
//
//	g, err := mt.DecodeMsgDetailedInfo(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *mt.MsgDetailedInfo: // msg_detailed_info#276d3ec6
//	case *mt.MsgNewDetailedInfo: // msg_new_detailed_info#809db6df
//	default: panic(v)
//	}
type MsgDetailedInfoClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MsgDetailedInfoClass

	// 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

	// AnswerMsgID field of MsgDetailedInfo.
	GetAnswerMsgID() (value int64)
	// Bytes field of MsgDetailedInfo.
	GetBytes() (value int)
	// Status field of MsgDetailedInfo.
	GetStatus() (value int)
}

// DecodeMsgDetailedInfo implements binary de-serialization for MsgDetailedInfoClass.
func ( *bin.Buffer) (MsgDetailedInfoClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MsgDetailedInfoTypeID:
		// Decoding msg_detailed_info#276d3ec6.
		 := MsgDetailedInfo{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MsgDetailedInfoClass: %w", )
		}
		return &, nil
	case MsgNewDetailedInfoTypeID:
		// Decoding msg_new_detailed_info#809db6df.
		 := MsgNewDetailedInfo{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MsgDetailedInfoClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MsgDetailedInfoClass: %w", bin.NewUnexpectedID())
	}
}

// MsgDetailedInfo boxes the MsgDetailedInfoClass providing a helper.
type MsgDetailedInfoBox struct {
	MsgDetailedInfo MsgDetailedInfoClass
}

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

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