using Health.Domain.Entities;

namespace Health.Application.Users;

public sealed record UserProfileDto(
    Guid Id,
    string? Phone,  // Apple 用户无手机号
    string Role,
    string? Name,
    string? Gender,
    string? BirthDate,
    string? AvatarUrl);

public sealed record UserProfileUpdateRequest(
    string? Name,
    string? Gender,
    DateOnly? BirthDate);

public sealed record AccountFileReferences(
    IReadOnlyList<string> FileUrls,
    IReadOnlyList<string> ConversationMetadataJson);

public interface IUserService
{
    Task<UserProfileDto?> GetProfileAsync(Guid userId, CancellationToken ct);
    Task<bool> UpdateProfileAsync(Guid userId, UserProfileUpdateRequest request, CancellationToken ct);
    Task DeleteAccountAsync(Guid userId, CancellationToken ct);
}

public interface IUserRepository
{
    Task<User?> GetAsync(Guid userId, CancellationToken ct);
    Task<AccountFileReferences> GetAccountFileReferencesAsync(Guid userId, CancellationToken ct);
    Task SaveChangesAsync(CancellationToken ct);
    Task DeleteAccountDataAsync(Guid userId, CancellationToken ct);
}

public interface IAccountFileCleanup
{
    Task DeleteAsync(Guid userId, AccountFileReferences references, CancellationToken ct);
}
