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

// PeerBlocked represents TL type `peerBlocked#e8fd8014`.
// Information about a blocked peer
//
// See https://core.telegram.org/constructor/peerBlocked for reference.
type PeerBlocked struct {
	// Peer ID
	PeerID PeerClass
	// When was the peer blocked
	Date int
}

// PeerBlockedTypeID is TL type id of PeerBlocked.
const PeerBlockedTypeID = 0xe8fd8014

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

func ( *PeerBlocked) () bool {
	if  == nil {
		return true
	}
	if !(.PeerID == nil) {
		return false
	}
	if !(.Date == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PeerBlocked from given interface.
func ( *PeerBlocked) ( interface {
	() ( PeerClass)
	() ( int)
}) {
	.PeerID = .()
	.Date = .()
}

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

// TypeName returns name of type in TL schema.
func (*PeerBlocked) () string {
	return "peerBlocked"
}

// TypeInfo returns info about TL type.
func ( *PeerBlocked) () tdp.Type {
	 := tdp.Type{
		Name: "peerBlocked",
		ID:   PeerBlockedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PeerID",
			SchemaName: "peer_id",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PeerBlocked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode peerBlocked#e8fd8014 as nil")
	}
	.PutID(PeerBlockedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PeerBlocked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode peerBlocked#e8fd8014 as nil")
	}
	if .PeerID == nil {
		return fmt.Errorf("unable to encode peerBlocked#e8fd8014: field peer_id is nil")
	}
	if  := .PeerID.Encode();  != nil {
		return fmt.Errorf("unable to encode peerBlocked#e8fd8014: field peer_id: %w", )
	}
	.PutInt(.Date)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PeerBlocked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode peerBlocked#e8fd8014 to nil")
	}
	{
		,  := DecodePeer()
		if  != nil {
			return fmt.Errorf("unable to decode peerBlocked#e8fd8014: field peer_id: %w", )
		}
		.PeerID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode peerBlocked#e8fd8014: field date: %w", )
		}
		.Date = 
	}
	return nil
}

// GetPeerID returns value of PeerID field.
func ( *PeerBlocked) () ( PeerClass) {
	if  == nil {
		return
	}
	return .PeerID
}

// GetDate returns value of Date field.
func ( *PeerBlocked) () ( int) {
	if  == nil {
		return
	}
	return .Date
}