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

// StoriesTogglePeerStoriesHiddenRequest represents TL type `stories.togglePeerStoriesHidden#bd0415c4`.
// Hide the active stories of a user, preventing them from being displayed on the action
// bar on the homescreen, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/stories#hiding-stories-of-other-users
//
// See https://core.telegram.org/method/stories.togglePeerStoriesHidden for reference.
type StoriesTogglePeerStoriesHiddenRequest struct {
	// Peer whose stories should be (un)hidden.
	Peer InputPeerClass
	// Whether to hide or unhide stories.
	Hidden bool
}

// StoriesTogglePeerStoriesHiddenRequestTypeID is TL type id of StoriesTogglePeerStoriesHiddenRequest.
const StoriesTogglePeerStoriesHiddenRequestTypeID = 0xbd0415c4

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *StoriesTogglePeerStoriesHiddenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.togglePeerStoriesHidden#bd0415c4 as nil")
	}
	.PutID(StoriesTogglePeerStoriesHiddenRequestTypeID)
	return .EncodeBare()
}

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

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

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

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

// GetHidden returns value of Hidden field.
func ( *StoriesTogglePeerStoriesHiddenRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Hidden
}

// StoriesTogglePeerStoriesHidden invokes method stories.togglePeerStoriesHidden#bd0415c4 returning error if any.
// Hide the active stories of a user, preventing them from being displayed on the action
// bar on the homescreen, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/stories#hiding-stories-of-other-users
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/stories.togglePeerStoriesHidden for reference.
func ( *Client) ( context.Context,  *StoriesTogglePeerStoriesHiddenRequest) (bool, error) {
	var  BoolBox

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