using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace Jellyfin.Database.Implementations;
///
/// Defines the type and extension points for multi database support.
///
public interface IJellyfinDatabaseProvider
{
///
/// Gets or Sets the Database Factory when initialisaition is done.
///
IDbContextFactory? DbContextFactory { get; set; }
///
/// Initialises jellyfins EFCore database access.
///
/// The EFCore database options.
void Initialise(DbContextOptionsBuilder options);
///
/// Will be invoked when EFCore wants to build its model.
///
/// The ModelBuilder from EFCore.
void OnModelCreating(ModelBuilder modelBuilder);
///
/// Will be invoked when EFCore wants to configure its model.
///
/// The ModelConfigurationBuilder from EFCore.
void ConfigureConventions(ModelConfigurationBuilder configurationBuilder);
///
/// If supported this should run any periodic maintaince tasks.
///
/// The token to abort the operation.
/// A representing the asynchronous operation.
Task RunScheduledOptimisation(CancellationToken cancellationToken);
///
/// If supported this should perform any actions that are required on stopping the jellyfin server.
///
/// The token that will be used to abort the operation.
/// A representing the asynchronous operation.
Task RunShutdownTask(CancellationToken cancellationToken);
///
/// Runs a full Database backup that can later be restored to.
///
/// A cancellation token.
/// A key to identify the backup.
/// May throw an NotImplementException if this operation is not supported for this database.
Task MigrationBackupFast(CancellationToken cancellationToken);
///
/// Restores a backup that has been previously created by .
///
/// The key to the backup from which the current database should be restored from.
/// A cancellation token.
/// A representing the result of the asynchronous operation.
Task RestoreBackupFast(string key, CancellationToken cancellationToken);
///
/// Removes all contents from the database.
///
/// The Database context.
/// The names of the tables to purge or null for all tables to be purged.
/// A Task.
Task PurgeDatabase(JellyfinDbContext dbContext, IEnumerable? tableNames);
}