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

namespace MyTelegram.Schema;

///<summary>
/// Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
/// See <a href="https://corefork.telegram.org/constructor/secureValueErrorData" />
///</summary>
[TlObject(0xe8a40bd9)]
public sealed class TSecureValueErrorData : ISecureValueError
{
    public uint ConstructorId => 0xe8a40bd9;
    ///<summary>
    /// The section of the user's Telegram Passport which has the error, one of <a href="https://corefork.telegram.org/constructor/secureValueTypePersonalDetails">secureValueTypePersonalDetails</a>, <a href="https://corefork.telegram.org/constructor/secureValueTypePassport">secureValueTypePassport</a>, <a href="https://corefork.telegram.org/constructor/secureValueTypeDriverLicense">secureValueTypeDriverLicense</a>, <a href="https://corefork.telegram.org/constructor/secureValueTypeIdentityCard">secureValueTypeIdentityCard</a>, <a href="https://corefork.telegram.org/constructor/secureValueTypeInternalPassport">secureValueTypeInternalPassport</a>, <a href="https://corefork.telegram.org/constructor/secureValueTypeAddress">secureValueTypeAddress</a>
    /// See <a href="https://corefork.telegram.org/type/SecureValueType" />
    ///</summary>
    public MyTelegram.Schema.ISecureValueType Type { get; set; }

    ///<summary>
    /// Data hash
    ///</summary>
    public ReadOnlyMemory<byte> DataHash { get; set; }

    ///<summary>
    /// Name of the data field which has the error
    ///</summary>
    public string Field { get; set; }

    ///<summary>
    /// Error message
    ///</summary>
    public string Text { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Type);
        writer.Write(DataHash);
        writer.Write(Field);
        writer.Write(Text);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Type = buffer.Read<MyTelegram.Schema.ISecureValueType>();
        DataHash = buffer.ReadBytes();
        Field = buffer.ReadString();
        Text = buffer.ReadString();
    }
}