using System.Text.Json;

namespace WorkTracker.Services.Storage;

public sealed class DatabaseBackupFile
{
    public required byte[] Content { get; init; }

    public required string ContentType { get; init; }

    public required string FileName { get; init; }
}

public sealed class DatabaseBackupPayload
{
    public int BackupFormatVersion { get; init; }

    public int DatabaseSchemaVersion { get; init; }

    public DateTimeOffset ExportedAtUtc { get; init; }

    public Dictionary<string, List<DatabaseBackupDocumentPayload>> Collections { get; init; } = [];
}

public sealed class DatabaseBackupDocumentPayload
{
    public string Id { get; init; } = string.Empty;

    public JsonElement Data { get; init; }
}

public sealed class DatabaseBackupException : Exception
{
    public DatabaseBackupException(string message)
        : base(message)
    {
    }
}