// <auto-generated/>
// ReSharper disable All

namespace MyTelegram.Schema;

///<summary>
/// Defines a file saved in parts using the method <a href="https://corefork.telegram.org/method/upload.saveFilePart">upload.saveFilePart</a>.
/// See <a href="https://corefork.telegram.org/constructor/inputFile" />
///</summary>
[TlObject(0xf52ff27f)]
public sealed class TInputFile : IInputFile
{
    public uint ConstructorId => 0xf52ff27f;
    ///<summary>
    /// Random file identifier created by the client
    ///</summary>
    public long Id { get; set; }

    ///<summary>
    /// Number of parts saved
    ///</summary>
    public int Parts { get; set; }

    ///<summary>
    /// Full name of the file
    ///</summary>
    public string Name { get; set; }

    ///<summary>
    /// In case the file's <a href="https://en.wikipedia.org/wiki/MD5#MD5_hashes">md5-hash</a> was passed, contents of the file will be checked prior to use
    ///</summary>
    public string Md5Checksum { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Id);
        writer.Write(Parts);
        writer.Write(Name);
        writer.Write(Md5Checksum);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Id = buffer.ReadInt64();
        Parts = buffer.ReadInt32();
        Name = buffer.ReadString();
        Md5Checksum = buffer.ReadString();
    }
}