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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Make a user admin in a <a href="https://corefork.telegram.org/api/channel#basic-groups">basic group</a>.
/// <para>Possible errors</para>
/// Code Type Description
/// 400 CHAT_ID_INVALID The provided chat id is invalid.
/// 400 PEER_ID_INVALID The provided peer id is invalid.
/// 400 USER_ID_INVALID The provided user ID is invalid.
/// 400 USER_NOT_PARTICIPANT You're not a member of this supergroup/channel.
/// See <a href="https://corefork.telegram.org/method/messages.editChatAdmin" />
///</summary>
[TlObject(0xa85bd1c2)]
public sealed class RequestEditChatAdmin : IRequest<IBool>
{
    public uint ConstructorId => 0xa85bd1c2;
    ///<summary>
    /// The ID of the group
    ///</summary>
    public long ChatId { get; set; }

    ///<summary>
    /// The user to make admin
    /// See <a href="https://corefork.telegram.org/type/InputUser" />
    ///</summary>
    public MyTelegram.Schema.IInputUser UserId { get; set; }

    ///<summary>
    /// Whether to make them admin
    /// See <a href="https://corefork.telegram.org/type/Bool" />
    ///</summary>
    public bool IsAdmin { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(ChatId);
        writer.Write(UserId);
        writer.Write(IsAdmin);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        ChatId = buffer.ReadInt64();
        UserId = buffer.Read<MyTelegram.Schema.IInputUser>();
        IsAdmin = buffer.Read();
    }
}
