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

namespace MyTelegram.Schema.Account;

///<summary>
/// Set sensitive content settings (for viewing or hiding NSFW content)
/// <para>Possible errors</para>
/// Code Type Description
/// 403 SENSITIVE_CHANGE_FORBIDDEN You can't change your sensitive content settings.
/// See <a href="https://corefork.telegram.org/method/account.setContentSettings" />
///</summary>
[TlObject(0xb574b16b)]
public sealed class RequestSetContentSettings : IRequest<IBool>
{
    public uint ConstructorId => 0xb574b16b;
    ///<summary>
    /// Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a>
    ///</summary>
    public int Flags { get; set; }

    ///<summary>
    /// Enable NSFW content
    /// See <a href="https://corefork.telegram.org/type/true" />
    ///</summary>
    public bool SensitiveEnabled { get; set; }

    public void ComputeFlag()
    {
        if (SensitiveEnabled) { Flags = Flags.SetBit(0); }
    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Flags);

    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { SensitiveEnabled = true; }
    }
}
