// <auto-generated/>

namespace MyTelegram.Schema;

[TlObject(0x73f1f8dc)]
public class TMsgContainer : IRequest<IObject>
{
    public uint ConstructorId => 0x73f1f8dc;
    public TContainerMessage[] Messages { get; set; }

    public void Serialize(IBufferWriter<byte> writer)
    {
        writer.Write(ConstructorId);
        writer.Write(Messages.Length);
        foreach (var containerMessage in Messages)
        {
            writer.Write(containerMessage);
        }
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        var length = buffer.ReadInt32();
        if (length > 0)
        {
            Messages = new TContainerMessage[length];
            for (int i = 0; i < length; i++)
            {
                var item = new TContainerMessage();
                item.Deserialize(ref buffer);
                Messages[i] = item;
            }
        }
    }
}