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

namespace MyTelegram.Schema;

///<summary>
/// Contains info about a <a href="https://corefork.telegram.org/api/business#connected-bots">connected business bot »</a>.
/// See <a href="https://corefork.telegram.org/constructor/connectedBot" />
///</summary>
[TlObject(0xcd64636c)]
public sealed class TConnectedBot : IConnectedBot
{
    public uint ConstructorId => 0xcd64636c;
    ///<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>
    /// ID of the connected bot
    ///</summary>
    public long BotId { get; set; }

    ///<summary>
    /// Specifies the private chats that a <a href="https://corefork.telegram.org/api/business#connected-bots">connected business bot »</a> may receive messages and interact with.<br>
    /// See <a href="https://corefork.telegram.org/type/BusinessBotRecipients" />
    ///</summary>
    public MyTelegram.Schema.IBusinessBotRecipients Recipients { get; set; }
    public MyTelegram.Schema.IBusinessBotRights Rights { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        BotId = buffer.ReadInt64();
        Recipients = buffer.Read<MyTelegram.Schema.IBusinessBotRecipients>();
        Rights = buffer.Read<MyTelegram.Schema.IBusinessBotRights>();
    }
}