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

namespace MyTelegram.Schema;

///<summary>
/// Progressively encoded photosize
/// See <a href="https://corefork.telegram.org/constructor/photoSizeProgressive" />
///</summary>
[TlObject(0xfa3efb95)]
public sealed class TPhotoSizeProgressive : IPhotoSize
{
    public uint ConstructorId => 0xfa3efb95;
    ///<summary>
    /// <a href="https://corefork.telegram.org/api/files#image-thumbnail-types">Photosize type »</a>
    ///</summary>
    public string Type { get; set; }

    ///<summary>
    /// Photo width
    ///</summary>
    public int W { get; set; }

    ///<summary>
    /// Photo height
    ///</summary>
    public int H { get; set; }

    ///<summary>
    /// Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image.
    ///</summary>
    public TVector<int> Sizes { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Type);
        writer.Write(W);
        writer.Write(H);
        writer.Write(Sizes);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Type = buffer.ReadString();
        W = buffer.ReadInt32();
        H = buffer.ReadInt32();
        Sizes = buffer.Read<TVector<int>>();
    }
}