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

namespace MyTelegram.Schema;

///<summary>
/// Description of an image and its content.
/// See <a href="https://corefork.telegram.org/constructor/photoCachedSize" />
///</summary>
[TlObject(0x21e1ad6)]
public sealed class TPhotoCachedSize : IPhotoSize
{
    public uint ConstructorId => 0x21e1ad6;
    ///<summary>
    /// Thumbnail type
    ///</summary>
    public string Type { get; set; }

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

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

    ///<summary>
    /// Binary data, file content
    ///</summary>
    public byte[] Bytes { 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(Bytes);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Type = buffer.ReadString();
        W = buffer.ReadInt32();
        H = buffer.ReadInt32();
        Bytes = buffer.ReadBytes();
    }
}