using Helpdesk.Application.Statistics; using Helpdesk.Domain.Auth; using Helpdesk.Domain.Catalogs; using Helpdesk.Domain.Issues; using Helpdesk.Domain.Notifications; using Helpdesk.Domain.Proposals; using Helpdesk.Domain.Users; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; namespace Helpdesk.Application.Abstractions; public interface IAppDbContext { DbSet Users { get; } DbSet AuthTokens { get; } DbSet Buildings { get; } DbSet IssueCategories { get; } DbSet ProposalCategories { get; } DbSet Issues { get; } DbSet IssueEvents { get; } IQueryable IssueTimings { get; } DbSet Attachments { get; } DbSet Proposals { get; } DbSet ProposalEvents { get; } DbSet ProposalVotes { get; } DbSet ProposalScores { get; } DbSet Notifications { get; } DbSet NotificationDeliveries { get; } DbSet PushDevices { get; } Task SaveChangesAsync(CancellationToken cancellationToken = default); Task BeginWriteAsync(CancellationToken ct); Task LockUserAsync(int id, CancellationToken ct); Task LockProposalAsync(int id, CancellationToken ct); Task RegisterPushDeviceAsync(int userId, string token, CancellationToken ct); } public interface IPasswordHasher { string Hash(string password); bool Verify(string password, string passwordHash); } /// Vydaný JWT: serializovaný token a záznam pro tabulku auth_token. public sealed record IssuedToken(string Token, AuthToken Record); /// Ověřený token: identifikátor jti a uživatel (sub). public sealed record ValidatedToken(string Jti, int UserId); public interface ITokenService { IssuedToken Issue(User user, TokenType type); /// Ověří podpis, typ, iss, aud a exp (RFC 7519, kap. 7.2). Neplatný token → null. Task ValidateAsync(string token, TokenType expectedType); } /// Paměťová evidence zneplatněných access tokenů, které ještě nevypršely (kap. 10.1). public interface IRevokedTokenStore { bool IsRevoked(string jti); void Add(string jti, DateTime expiresAt); } public interface IEmailSender { Task SendAsync(string to, string subject, string body, CancellationToken cancellationToken = default); } /// Přihlášený uživatel aktuálního požadavku (claimy access tokenu). public interface ICurrentUser { int Id { get; } string TokenId { get; } }