using System.Security.Claims;
using SharepointToolbox.Web.Core.Models;
namespace SharepointToolbox.Web.Services.Auth;
public interface IUserService
{
/// Auto-provision on first OIDC login; update LastLogin on subsequent logins.
/// First user ever becomes Admin automatically. Tags the user as .
Task ProvisionAsync(ClaimsPrincipal principal);
Task GetByEmailAsync(string email);
Task> GetAllAsync();
/// Persist a new role for the user. Returns the previous role (read from the store).
/// No user matches .
Task UpdateRoleAsync(string userId, UserRole role);
Task DeleteAsync(string userId);
/// Create a local password-based account. First user ever becomes Admin.
/// Email already in use.
Task CreateLocalUserAsync(string email, string displayName, UserRole role, string password);
/// Validate local credentials. Returns the user and updates LastLogin on success; null otherwise.
/// Only matches accounts.
Task ValidateLocalCredentialsAsync(string email, string password);
/// Admin reset — set a local user's password without knowing the current one.
Task SetPasswordAsync(string userId, string newPassword);
/// Self-service — change own password after verifying the current one.
/// true if the current password matched and the change was saved.
Task ChangePasswordAsync(string userId, string currentPassword, string newPassword);
}