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

// StoriesCanSendStoryRequest represents TL type `stories.canSendStory#c7dfdfdd`.
// Check whether we can post stories as the specified peer.
//
// See https://core.telegram.org/method/stories.canSendStory for reference.
type StoriesCanSendStoryRequest struct {
	// The peer from which we wish to post stories.
	Peer InputPeerClass
}

// StoriesCanSendStoryRequestTypeID is TL type id of StoriesCanSendStoryRequest.
const StoriesCanSendStoryRequestTypeID = 0xc7dfdfdd

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

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

	return true
}

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

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

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

// TypeName returns name of type in TL schema.
func (*StoriesCanSendStoryRequest) () string {
	return "stories.canSendStory"
}

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

// Encode implements bin.Encoder.
func ( *StoriesCanSendStoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.canSendStory#c7dfdfdd as nil")
	}
	.PutID(StoriesCanSendStoryRequestTypeID)
	return .EncodeBare()
}

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

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

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

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

// StoriesCanSendStory invokes method stories.canSendStory#c7dfdfdd returning error if any.
// Check whether we can post stories as the specified peer.
//
// Possible errors:
//
//	400 BOOSTS_REQUIRED: The specified channel must first be boosted by its users in order to perform this action.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action.
//	400 STORIES_TOO_MUCH: You have hit the maximum active stories limit as specified by the story_expiring_limit_* client configuration parameters: you should buy a Premium subscription, delete an active story, or wait for the oldest story to expire.
//	400 STORY_SEND_FLOOD_MONTHLY_%d: You've hit the monthly story limit as specified by the stories_sent_monthly_limit_* client configuration parameters: wait for the specified number of seconds before posting a new story.
//	400 STORY_SEND_FLOOD_WEEKLY_%d: You've hit the weekly story limit as specified by the stories_sent_weekly_limit_* client configuration parameters: wait for the specified number of seconds before posting a new story.
//
// See https://core.telegram.org/method/stories.canSendStory for reference.
func ( *Client) ( context.Context,  InputPeerClass) (bool, error) {
	var  BoolBox

	 := &StoriesCanSendStoryRequest{
		Peer: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}