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

namespace MyTelegram.Schema.Fragment;

///<summary>
/// Info about a <a href="https://corefork.telegram.org/api/fragment">fragment collectible</a>.
/// See <a href="https://corefork.telegram.org/constructor/fragment.collectibleInfo" />
///</summary>
[TlObject(0x6ebdff91)]
public sealed class TCollectibleInfo : ICollectibleInfo
{
    public uint ConstructorId => 0x6ebdff91;
    ///<summary>
    /// Purchase date (unixtime)
    ///</summary>
    public int PurchaseDate { get; set; }

    ///<summary>
    /// Three-letter ISO 4217 <a href="https://corefork.telegram.org/bots/payments#supported-currencies">currency</a> code for <code>amount</code>
    ///</summary>
    public string Currency { get; set; }

    ///<summary>
    /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of <code>US$ 1.45</code> pass <code>amount = 145</code>. See the exp parameter in <a href="https://corefork.telegram.org/bots/payments/currencies.json">currencies.json</a>, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
    ///</summary>
    public long Amount { get; set; }

    ///<summary>
    /// Cryptocurrency name.
    ///</summary>
    public string CryptoCurrency { get; set; }

    ///<summary>
    /// Price, in the smallest units of the cryptocurrency.
    ///</summary>
    public long CryptoAmount { get; set; }

    ///<summary>
    /// <a href="https://fragment.com/">Fragment</a> URL with more info about the collectible
    ///</summary>
    public string Url { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(PurchaseDate);
        writer.Write(Currency);
        writer.Write(Amount);
        writer.Write(CryptoCurrency);
        writer.Write(CryptoAmount);
        writer.Write(Url);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        PurchaseDate = buffer.ReadInt32();
        Currency = buffer.ReadString();
        Amount = buffer.ReadInt64();
        CryptoCurrency = buffer.ReadString();
        CryptoAmount = buffer.ReadInt64();
        Url = buffer.ReadString();
    }
}