using Newtonsoft.Json;
using VoidCat.Services.Abstractions;
// ReSharper disable InconsistentNaming
namespace VoidCat.Model;
///
/// Base metadata must contain version number
///
public interface IFileMeta
{
const int CurrentVersion = 3;
int Version { get; init; }
}
///
/// File metadata which is managed by
///
public record FileMeta : IFileMeta
{
///
/// Metadata version
///
public int Version { get; init; } = IFileMeta.CurrentVersion;
///
/// Internal Id of the file
///
[JsonConverter(typeof(Base58GuidConverter))]
public Guid Id { get; set; }
///
/// Filename
///
public string? Name { get; set; }
///
/// Size of the file in storage
///
public ulong Size { get; init; }
///
/// Date file was uploaded
///
public DateTimeOffset Uploaded { get; init; } = DateTimeOffset.UtcNow;
///
/// Description about the file
///
public string? Description { get; set; }
///
/// The content type of the file
///
public string? MimeType { get; set; }
///
/// SHA-256 hash of the file
///
public string? Digest { get; set; }
///
/// Url to download the file
///
public Uri? Url { get; set; }
///
/// Time when the file will expire and be deleted
///
public DateTimeOffset? Expires { get; set; }
///
/// What storage system the file is on
///
public string? Storage { get; set; }
///
/// Encryption params as JSON string
///
public string? EncryptionParams { get; set; }
///
/// Magnet link for downloads
///
public string? MagnetLink { get; set; }
}
///
/// with attached
///
public record SecretFileMeta : FileMeta
{
///
/// A secret key used to make edits to the file after its uploaded
///
[JsonConverter(typeof(Base58GuidConverter))]
public Guid EditSecret { get; init; }
}