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

namespace MyTelegram.Schema;

///<summary>
/// Use this object to download a photo with <a href="https://corefork.telegram.org/method/upload.getFile">upload.getFile</a> method
/// See <a href="https://corefork.telegram.org/constructor/inputPhotoFileLocation" />
///</summary>
[TlObject(0x40181ffe)]
public sealed class TInputPhotoFileLocation : IInputFileLocation
{
    public uint ConstructorId => 0x40181ffe;
    ///<summary>
    /// Photo ID, obtained from the <a href="https://corefork.telegram.org/constructor/photo">photo</a> object
    ///</summary>
    public long Id { get; set; }

    ///<summary>
    /// Photo's access hash, obtained from the <a href="https://corefork.telegram.org/constructor/photo">photo</a> object
    ///</summary>
    public long AccessHash { get; set; }

    ///<summary>
    /// <a href="https://corefork.telegram.org/api/file_reference">File reference</a>
    ///</summary>
    public ReadOnlyMemory<byte> FileReference { get; set; }

    ///<summary>
    /// The <a href="https://corefork.telegram.org/type/PhotoSize">PhotoSize</a> to download: must be set to the <code>type</code> field of the desired PhotoSize object of the <a href="https://corefork.telegram.org/constructor/photo">photo</a>
    ///</summary>
    public string ThumbSize { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Id);
        writer.Write(AccessHash);
        writer.Write(FileReference);
        writer.Write(ThumbSize);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Id = buffer.ReadInt64();
        AccessHash = buffer.ReadInt64();
        FileReference = buffer.ReadBytes();
        ThumbSize = buffer.ReadString();
    }
}