#nullable enable
using Baya.Application.Models.Identity;
using Baya.Domain.Entities.Identity;

namespace Baya.Application.Contracts.Persistence;

public interface ICustomerProfileRepository
{
    /// <summary>Tracked lookup of the customer's profile by owning user id (for upsert).</summary>
    Task<CustomerProfile?> GetByUserIdAsync(int userId, CancellationToken cancellationToken);

    Task AddAsync(CustomerProfile profile, CancellationToken cancellationToken);

    /// <summary>No-tracking projection of the signed-in customer's profile (emergency contact decrypted,
    /// full, for the owner).</summary>
    Task<CustomerProfileDto?> GetMineAsync(int userId, CancellationToken cancellationToken);

    /// <summary>The customer's <c>customer_profiles.id</c> from their user id — the tenancy anchor for
    /// patient operations. NULL when the user has no customer profile yet.</summary>
    Task<long?> GetProfileIdByUserIdAsync(int userId, CancellationToken cancellationToken);

    /// <summary>The owning <c>users.id</c> for a customer profile — the notification recipient for a review
    /// outcome. NULL when the profile does not exist.</summary>
    Task<int?> GetUserIdByProfileIdAsync(long customerProfileId, CancellationToken cancellationToken);
}
