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

// GroupCallStreamChannel represents TL type `groupCallStreamChannel#80eb48af`.
// Info about an RTMP stream in a group call or livestream
//
// See https://core.telegram.org/constructor/groupCallStreamChannel for reference.
type GroupCallStreamChannel struct {
	// Channel ID
	Channel int
	// Specifies the duration of the video segment to fetch in milliseconds, by bitshifting
	// 1000 to the right scale times: duration_ms := 1000 >> scale.
	Scale int
	// Last seen timestamp to easily start fetching livestream chunks using
	// inputGroupCallStream¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputGroupCallStream
	LastTimestampMs int64
}

// GroupCallStreamChannelTypeID is TL type id of GroupCallStreamChannel.
const GroupCallStreamChannelTypeID = 0x80eb48af

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

func ( *GroupCallStreamChannel) () bool {
	if  == nil {
		return true
	}
	if !(.Channel == 0) {
		return false
	}
	if !(.Scale == 0) {
		return false
	}
	if !(.LastTimestampMs == 0) {
		return false
	}

	return true
}

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

// FillFrom fills GroupCallStreamChannel from given interface.
func ( *GroupCallStreamChannel) ( interface {
	() ( int)
	() ( int)
	() ( int64)
}) {
	.Channel = .()
	.Scale = .()
	.LastTimestampMs = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *GroupCallStreamChannel) () tdp.Type {
	 := tdp.Type{
		Name: "groupCallStreamChannel",
		ID:   GroupCallStreamChannelTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Scale",
			SchemaName: "scale",
		},
		{
			Name:       "LastTimestampMs",
			SchemaName: "last_timestamp_ms",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *GroupCallStreamChannel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode groupCallStreamChannel#80eb48af as nil")
	}
	.PutID(GroupCallStreamChannelTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *GroupCallStreamChannel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode groupCallStreamChannel#80eb48af as nil")
	}
	.PutInt(.Channel)
	.PutInt(.Scale)
	.PutLong(.LastTimestampMs)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *GroupCallStreamChannel) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode groupCallStreamChannel#80eb48af to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallStreamChannel#80eb48af: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallStreamChannel#80eb48af: field scale: %w", )
		}
		.Scale = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode groupCallStreamChannel#80eb48af: field last_timestamp_ms: %w", )
		}
		.LastTimestampMs = 
	}
	return nil
}

// GetChannel returns value of Channel field.
func ( *GroupCallStreamChannel) () ( int) {
	if  == nil {
		return
	}
	return .Channel
}

// GetScale returns value of Scale field.
func ( *GroupCallStreamChannel) () ( int) {
	if  == nil {
		return
	}
	return .Scale
}

// GetLastTimestampMs returns value of LastTimestampMs field.
func ( *GroupCallStreamChannel) () ( int64) {
	if  == nil {
		return
	}
	return .LastTimestampMs
}