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

namespace MyTelegram.Schema.Account;

///<summary>
/// Contains media autosave settings
/// See <a href="https://corefork.telegram.org/constructor/account.autoSaveSettings" />
///</summary>
[TlObject(0x4c3e069d)]
public sealed class TAutoSaveSettings : IAutoSaveSettings
{
    public uint ConstructorId => 0x4c3e069d;
    ///<summary>
    /// Default media autosave settings for private chats
    /// See <a href="https://corefork.telegram.org/type/AutoSaveSettings" />
    ///</summary>
    public MyTelegram.Schema.IAutoSaveSettings UsersSettings { get; set; }

    ///<summary>
    /// Default media autosave settings for <a href="https://corefork.telegram.org/api/channel">groups and supergroups</a>
    /// See <a href="https://corefork.telegram.org/type/AutoSaveSettings" />
    ///</summary>
    public MyTelegram.Schema.IAutoSaveSettings ChatsSettings { get; set; }

    ///<summary>
    /// Default media autosave settings for <a href="https://corefork.telegram.org/api/channel">channels</a>
    /// See <a href="https://corefork.telegram.org/type/AutoSaveSettings" />
    ///</summary>
    public MyTelegram.Schema.IAutoSaveSettings BroadcastsSettings { get; set; }

    ///<summary>
    /// Peer-specific granular autosave settings
    ///</summary>
    public TVector<MyTelegram.Schema.IAutoSaveException> Exceptions { get; set; }

    ///<summary>
    /// Chats mentioned in the peer-specific granular autosave settings
    ///</summary>
    public TVector<MyTelegram.Schema.IChat> Chats { get; set; }

    ///<summary>
    /// Users mentioned in the peer-specific granular autosave settings
    ///</summary>
    public TVector<MyTelegram.Schema.IUser> Users { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(UsersSettings);
        writer.Write(ChatsSettings);
        writer.Write(BroadcastsSettings);
        writer.Write(Exceptions);
        writer.Write(Chats);
        writer.Write(Users);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        UsersSettings = buffer.Read<MyTelegram.Schema.IAutoSaveSettings>();
        ChatsSettings = buffer.Read<MyTelegram.Schema.IAutoSaveSettings>();
        BroadcastsSettings = buffer.Read<MyTelegram.Schema.IAutoSaveSettings>();
        Exceptions = buffer.Read<TVector<MyTelegram.Schema.IAutoSaveException>>();
        Chats = buffer.Read<TVector<MyTelegram.Schema.IChat>>();
        Users = buffer.Read<TVector<MyTelegram.Schema.IUser>>();
    }
}