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

// MsgCopy represents TL type `msg_copy#e06046b2`.
type MsgCopy struct {
	// OrigMessage field of MsgCopy.
	OrigMessage Message
}

// MsgCopyTypeID is TL type id of MsgCopy.
const MsgCopyTypeID = 0xe06046b2

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

func ( *MsgCopy) () bool {
	if  == nil {
		return true
	}
	if !(.OrigMessage.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *MsgCopy) () tdp.Type {
	 := tdp.Type{
		Name: "msg_copy",
		ID:   MsgCopyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "OrigMessage",
			SchemaName: "orig_message",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MsgCopy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode msg_copy#e06046b2 as nil")
	}
	.PutID(MsgCopyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MsgCopy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode msg_copy#e06046b2 as nil")
	}
	if  := .OrigMessage.Encode();  != nil {
		return fmt.Errorf("unable to encode msg_copy#e06046b2: field orig_message: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MsgCopy) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode msg_copy#e06046b2 to nil")
	}
	{
		if  := .OrigMessage.Decode();  != nil {
			return fmt.Errorf("unable to decode msg_copy#e06046b2: field orig_message: %w", )
		}
	}
	return nil
}

// GetOrigMessage returns value of OrigMessage field.
func ( *MsgCopy) () ( Message) {
	if  == nil {
		return
	}
	return .OrigMessage
}