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

// MessagesCheckedHistoryImportPeer represents TL type `messages.checkedHistoryImportPeer#a24de717`.
// Contains a confirmation text to be shown to the user, upon importing chat history,
// click here for more info »¹.
//
// Links:
//  1. https://core.telegram.org/api/import
//
// See https://core.telegram.org/constructor/messages.checkedHistoryImportPeer for reference.
type MessagesCheckedHistoryImportPeer struct {
	// A confirmation text to be shown to the user, upon importing chat history »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/import
	ConfirmText string
}

// MessagesCheckedHistoryImportPeerTypeID is TL type id of MessagesCheckedHistoryImportPeer.
const MessagesCheckedHistoryImportPeerTypeID = 0xa24de717

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

func ( *MessagesCheckedHistoryImportPeer) () bool {
	if  == nil {
		return true
	}
	if !(.ConfirmText == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesCheckedHistoryImportPeer from given interface.
func ( *MessagesCheckedHistoryImportPeer) ( interface {
	() ( string)
}) {
	.ConfirmText = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesCheckedHistoryImportPeer) () tdp.Type {
	 := tdp.Type{
		Name: "messages.checkedHistoryImportPeer",
		ID:   MessagesCheckedHistoryImportPeerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ConfirmText",
			SchemaName: "confirm_text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesCheckedHistoryImportPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkedHistoryImportPeer#a24de717 as nil")
	}
	.PutID(MessagesCheckedHistoryImportPeerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesCheckedHistoryImportPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.checkedHistoryImportPeer#a24de717 as nil")
	}
	.PutString(.ConfirmText)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesCheckedHistoryImportPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.checkedHistoryImportPeer#a24de717 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.checkedHistoryImportPeer#a24de717: field confirm_text: %w", )
		}
		.ConfirmText = 
	}
	return nil
}

// GetConfirmText returns value of ConfirmText field.
func ( *MessagesCheckedHistoryImportPeer) () ( string) {
	if  == nil {
		return
	}
	return .ConfirmText
}