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

// MessagesGetMessageEditDataRequest represents TL type `messages.getMessageEditData#fda68d36`.
// Find out if a media message's caption can be edited
//
// See https://core.telegram.org/method/messages.getMessageEditData for reference.
type MessagesGetMessageEditDataRequest struct {
	// Peer where the media was sent
	Peer InputPeerClass
	// ID of message
	ID int
}

// MessagesGetMessageEditDataRequestTypeID is TL type id of MessagesGetMessageEditDataRequest.
const MessagesGetMessageEditDataRequestTypeID = 0xfda68d36

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

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

	return true
}

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

// FillFrom fills MessagesGetMessageEditDataRequest from given interface.
func ( *MessagesGetMessageEditDataRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.ID = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesGetMessageEditDataRequest) () string {
	return "messages.getMessageEditData"
}

// TypeInfo returns info about TL type.
func ( *MessagesGetMessageEditDataRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.getMessageEditData",
		ID:   MessagesGetMessageEditDataRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesGetMessageEditDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessageEditData#fda68d36 as nil")
	}
	.PutID(MessagesGetMessageEditDataRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesGetMessageEditDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getMessageEditData#fda68d36 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.getMessageEditData#fda68d36: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.getMessageEditData#fda68d36: field peer: %w", )
	}
	.PutInt(.ID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesGetMessageEditDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.getMessageEditData#fda68d36 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageEditData#fda68d36: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.getMessageEditData#fda68d36: field id: %w", )
		}
		.ID = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *MessagesGetMessageEditDataRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

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

// MessagesGetMessageEditData invokes method messages.getMessageEditData#fda68d36 returning error if any.
// Find out if a media message's caption can be edited
//
// Possible errors:
//
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	403 MESSAGE_AUTHOR_REQUIRED: Message author required.
//	400 MESSAGE_ID_INVALID: The provided message id is invalid.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.getMessageEditData for reference.
func ( *Client) ( context.Context,  *MessagesGetMessageEditDataRequest) (*MessagesMessageEditData, error) {
	var  MessagesMessageEditData

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}