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

namespace MyTelegram.Schema.Account;

///<summary>
/// Set a list of <a href="https://corefork.telegram.org/api/business#greeting-messages">Telegram Business greeting messages</a>.
/// See <a href="https://corefork.telegram.org/method/account.updateBusinessGreetingMessage" />
///</summary>
[TlObject(0x66cdafc4)]
public sealed class RequestUpdateBusinessGreetingMessage : IRequest<IBool>
{
    public uint ConstructorId => 0x66cdafc4;
    ///<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>
    /// Greeting message configuration and contents.
    /// See <a href="https://corefork.telegram.org/type/InputBusinessGreetingMessage" />
    ///</summary>
    public MyTelegram.Schema.IInputBusinessGreetingMessage? Message { get; set; }

    public void ComputeFlag()
    {
        if (Message != null) { Flags = Flags.SetBit(0); }
    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Flags);
        if (Flags.IsBitSet(0)) { writer.Write(Message); }
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { Message = buffer.Read<MyTelegram.Schema.IInputBusinessGreetingMessage>(); }
    }
}
