sharp-chat/SharpChat.Common/DataProvider/Null/NullUserAuthResponse.cs

29 lines
1,015 B
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Users;
using SharpChat.Users.Remote;
using System;
namespace SharpChat.DataProvider.Null {
public class NullUserAuthResponse : IUserAuthResponse {
public long UserId { get; }
public string UserName { get; }
public int Rank { get; }
public Colour Colour { get; }
public UserPermissions Permissions { get; }
public DateTimeOffset SilencedUntil => DateTimeOffset.MinValue;
public NullUserAuthResponse(UserAuthRequest uar) {
UserId = uar.UserId;
UserName = $@"Misaka-{uar.UserId}";
Rank = (int)(uar.UserId % 10);
Random rng = new((int)uar.UserId);
Colour = new(rng.Next());
Permissions = (UserPermissions)rng.Next();
}
public bool Equals(IUser other)
=> other is NullUserAuthResponse && other.UserId == UserId;
public bool Equals(IRemoteUser other)
=> other is NullUserAuthResponse && other.UserId == UserId;
}
}