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

// MessagesGetPeerSettingsRequest represents TL type `messages.getPeerSettings#efd9a6a2`.
// Get peer settings
//
// See https://core.telegram.org/method/messages.getPeerSettings for reference.
type MessagesGetPeerSettingsRequest struct {
	// The peer
	Peer InputPeerClass
}

// MessagesGetPeerSettingsRequestTypeID is TL type id of MessagesGetPeerSettingsRequest.
const MessagesGetPeerSettingsRequestTypeID = 0xefd9a6a2

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesGetPeerSettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.getPeerSettings#efd9a6a2 as nil")
	}
	.PutID(MessagesGetPeerSettingsRequestTypeID)
	return .EncodeBare()
}

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

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

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

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

// MessagesGetPeerSettings invokes method messages.getPeerSettings#efd9a6a2 returning error if any.
// Get peer settings
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/messages.getPeerSettings for reference.
func ( *Client) ( context.Context,  InputPeerClass) (*MessagesPeerSettings, error) {
	var  MessagesPeerSettings

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