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

// ChannelAdminLogEvent represents TL type `channelAdminLogEvent#1fad68cd`.
// Admin log event
//
// See https://core.telegram.org/constructor/channelAdminLogEvent for reference.
type ChannelAdminLogEvent struct {
	// Event ID
	ID int64
	// Date
	Date int
	// User ID
	UserID int64
	// Action
	Action ChannelAdminLogEventActionClass
}

// ChannelAdminLogEventTypeID is TL type id of ChannelAdminLogEvent.
const ChannelAdminLogEventTypeID = 0x1fad68cd

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

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

	return true
}

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

// FillFrom fills ChannelAdminLogEvent from given interface.
func ( *ChannelAdminLogEvent) ( interface {
	() ( int64)
	() ( int)
	() ( int64)
	() ( ChannelAdminLogEventActionClass)
}) {
	.ID = .()
	.Date = .()
	.UserID = .()
	.Action = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *ChannelAdminLogEvent) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channelAdminLogEvent#1fad68cd as nil")
	}
	.PutID(ChannelAdminLogEventTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelAdminLogEvent) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channelAdminLogEvent#1fad68cd as nil")
	}
	.PutLong(.ID)
	.PutInt(.Date)
	.PutLong(.UserID)
	if .Action == nil {
		return fmt.Errorf("unable to encode channelAdminLogEvent#1fad68cd: field action is nil")
	}
	if  := .Action.Encode();  != nil {
		return fmt.Errorf("unable to encode channelAdminLogEvent#1fad68cd: field action: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChannelAdminLogEvent) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channelAdminLogEvent#1fad68cd to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode channelAdminLogEvent#1fad68cd: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode channelAdminLogEvent#1fad68cd: field date: %w", )
		}
		.Date = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode channelAdminLogEvent#1fad68cd: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := DecodeChannelAdminLogEventAction()
		if  != nil {
			return fmt.Errorf("unable to decode channelAdminLogEvent#1fad68cd: field action: %w", )
		}
		.Action = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *ChannelAdminLogEvent) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}

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

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

// GetAction returns value of Action field.
func ( *ChannelAdminLogEvent) () ( ChannelAdminLogEventActionClass) {
	if  == nil {
		return
	}
	return .Action
}