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

namespace MyTelegram.Schema.Channels;

///<summary>
/// Associate a group to a channel as <a href="https://corefork.telegram.org/api/discussion">discussion group</a> for that channel
/// <para>Possible errors</para>
/// Code Type Description
/// 400 BROADCAST_ID_INVALID Broadcast ID invalid.
/// 400 CHANNEL_INVALID The provided channel is invalid.
/// 400 CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this.
/// 403 CHAT_WRITE_FORBIDDEN You can't write in this chat.
/// 400 LINK_NOT_MODIFIED Discussion link not modified.
/// 400 MEGAGROUP_ID_INVALID Invalid supergroup ID.
/// 400 MEGAGROUP_PREHISTORY_HIDDEN Group with hidden history for new members can't be set as discussion groups.
/// See <a href="https://corefork.telegram.org/method/channels.setDiscussionGroup" />
///</summary>
[TlObject(0x40582bb2)]
public sealed class RequestSetDiscussionGroup : IRequest<IBool>
{
    public uint ConstructorId => 0x40582bb2;
    ///<summary>
    /// Channel
    /// See <a href="https://corefork.telegram.org/type/InputChannel" />
    ///</summary>
    public MyTelegram.Schema.IInputChannel Broadcast { get; set; }

    ///<summary>
    /// <a href="https://corefork.telegram.org/api/discussion">Discussion group</a> to associate to the channel
    /// See <a href="https://corefork.telegram.org/type/InputChannel" />
    ///</summary>
    public MyTelegram.Schema.IInputChannel Group { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Broadcast = buffer.Read<MyTelegram.Schema.IInputChannel>();
        Group = buffer.Read<MyTelegram.Schema.IInputChannel>();
    }
}
