sharp-chat/SharpChat.Common/Events/UserBanCreatedEvent.cs

29 lines
898 B
C#

using SharpChat.Users.Remote;
using System;
namespace SharpChat.Events {
[Event(TYPE)]
public class UserBanCreatedEvent : Event {
public const string TYPE = @"ban:create";
public long ModeratorUserId { get; }
public bool IsPermanent { get; }
public long Duration { get; }
public string Reason { get; }
public UserBanCreatedEvent(
IRemoteUser subject,
IRemoteUser moderator,
bool permanent,
TimeSpan duration,
string reason
) : base(
(subject ?? throw new ArgumentNullException(nameof(subject))).UserId
) {
ModeratorUserId = moderator?.UserId ?? -1;
IsPermanent = permanent;
Duration = (long)duration.TotalSeconds;
Reason = reason ?? throw new ArgumentNullException(nameof(reason));
}
}
}