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

// ReadParticipantDate represents TL type `readParticipantDate#4a4ff172`.
// Contains info about when a certain participant has read a message
//
// See https://core.telegram.org/constructor/readParticipantDate for reference.
type ReadParticipantDate struct {
	// User ID
	UserID int64
	// When the user read the message
	Date int
}

// ReadParticipantDateTypeID is TL type id of ReadParticipantDate.
const ReadParticipantDateTypeID = 0x4a4ff172

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

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

	return true
}

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

// FillFrom fills ReadParticipantDate from given interface.
func ( *ReadParticipantDate) ( interface {
	() ( int64)
	() ( int)
}) {
	.UserID = .()
	.Date = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ReadParticipantDate) () tdp.Type {
	 := tdp.Type{
		Name: "readParticipantDate",
		ID:   ReadParticipantDateTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ReadParticipantDate) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode readParticipantDate#4a4ff172 as nil")
	}
	.PutID(ReadParticipantDateTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ReadParticipantDate) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode readParticipantDate#4a4ff172 as nil")
	}
	.PutLong(.UserID)
	.PutInt(.Date)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ReadParticipantDate) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode readParticipantDate#4a4ff172 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode readParticipantDate#4a4ff172: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode readParticipantDate#4a4ff172: field date: %w", )
		}
		.Date = 
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *ReadParticipantDate) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

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