using Microsoft.EntityFrameworkCore;
using sotd.Pages;

public class DataContext : DbContext
{
    public static DataContext Instance
    {
        get { return new DataContext(); }
    }

    public DbSet<User>? Users { get; set; }
    public DbSet<Song>? Songs { get; set; }
    public DbSet<SongSuggestion>? SongSuggestions { get; set; }
    public DbSet<SuggestionHelper>? SuggestionHelpers { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.UseNpgsql($"Host={AppConfiguration.Instance.DatabaseUri}:{AppConfiguration.Instance.DatabasePort};"
                                    + $"Username={AppConfiguration.Instance.DatabaseUser};Password={AppConfiguration.Instance.DatabasePW};"
                                    + $"Database={AppConfiguration.Instance.DatabaseName}");
}