namespace DataTransfer.Client.Services;
public enum ChatEntryKind
{
Incoming,
Outgoing,
System
}
public sealed class ChatEntry
{
public DateTimeOffset Time { get; } = DateTimeOffset.Now;
public bool IsFile => FileName is not null;
public bool IsTransferring => IsFile && Error is null && TransferredBytes < FileSize;
public int ProgressPercent => FileSize == 0 ? 100 : (int)(TransferredBytes * 100 / FileSize);
public required ChatEntryKind Kind { get; init; }
public string? Text { get; init; }
public string? FileName { get; init; }
public long FileSize { get; init; }
public long TransferredBytes { get; set; }
/// Object URL of a completely received and decrypted file.
public string? DownloadUrl { get; set; }
/// A received file whose type can run code or is often used for malware or phishing.
public bool IsRiskyFile { get; init; }
public string? Error { get; set; }
}