using Microsoft.EntityFrameworkCore;
using OmsorgCore.Domain.Entities;

namespace OmsorgCore.Infrastructure.Persistence;

public class OmsorgCoreDbContext : DbContext
{
    public OmsorgCoreDbContext(DbContextOptions<OmsorgCoreDbContext> options) : base(options)
    {
    }

    public DbSet<Employee> Employees => Set<Employee>();
    public DbSet<Facility> Facilities => Set<Facility>();
    public DbSet<FacilityContact> FacilityContacts => Set<FacilityContact>();
    public DbSet<FacilityQualificationRate> FacilityQualificationRates => Set<FacilityQualificationRate>();
    public DbSet<EmployeeFacilityDistance> EmployeeFacilityDistances => Set<EmployeeFacilityDistance>();
    public DbSet<Contract> Contracts => Set<Contract>();
    public DbSet<Order> Orders => Set<Order>();
    public DbSet<Assignment> Assignments => Set<Assignment>();
    public DbSet<Absence> Absences => Set<Absence>();
    public DbSet<AssignmentValidationSettings> AssignmentValidationSettings => Set<AssignmentValidationSettings>();
    public DbSet<ValueList> ValueLists => Set<ValueList>();
    public DbSet<ValueListItem> ValueListItems => Set<ValueListItem>();
    public DbSet<ValueListItemTransition> ValueListItemTransitions => Set<ValueListItemTransition>();
    public DbSet<TimeEntry> TimeEntries => Set<TimeEntry>();
    public DbSet<Invoice> Invoices => Set<Invoice>();
    public DbSet<Document> Documents => Set<Document>();

    public DbSet<User> Users => Set<User>();
    public DbSet<Role> Roles => Set<Role>();
    public DbSet<RolePermission> RolePermissions => Set<RolePermission>();
    public DbSet<UserPermissionOverride> UserPermissionOverrides => Set<UserPermissionOverride>();
    public DbSet<RefreshToken> RefreshTokens => Set<RefreshToken>();
    public DbSet<PasswordResetCode> PasswordResetCodes => Set<PasswordResetCode>();
    public DbSet<LoginAttempt> LoginAttempts => Set<LoginAttempt>();
    public DbSet<AuditLogEntry> AuditLogEntries => Set<AuditLogEntry>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfigurationsFromAssembly(typeof(OmsorgCoreDbContext).Assembly);
        base.OnModelCreating(modelBuilder);
    }
}
