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

namespace Baya.Application.Contracts.Persistence;

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

    /// <summary>Tracked lookup of the nurse's profile by its own id — the verification finalize/suspend
    /// transaction loads it to flip the guarded <c>is_verified</c> flag in the same commit.</summary>
    Task<NurseProfile?> GetTrackedByIdAsync(long nurseProfileId, CancellationToken cancellationToken);

    Task AddAsync(NurseProfile profile, CancellationToken cancellationToken);

    /// <summary>No-tracking projection of the signed-in nurse's profile, incl. read-only verified flag
    /// and aggregates.</summary>
    Task<NurseProfileDto?> GetMineAsync(int userId, CancellationToken cancellationToken);

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

    /// <summary>The nurse's <c>nurse_profiles.id</c> + decrypted national id — what the bank-account
    /// ownership inquiry needs. NULL when the user has no nurse profile yet.</summary>
    Task<NurseIdentityContext?> GetIdentityContextByUserIdAsync(int userId, CancellationToken cancellationToken);

    /// <summary>The target nurse's booking-relevant facts (user id, gender, verified/accepting gates) in one
    /// read — what a booking-request create needs to notify the nurse and run the bookability + same-gender
    /// checks. NULL when no such nurse profile exists.</summary>
    Task<NurseBookingContext?> GetBookingContextByIdAsync(long nurseProfileId, CancellationToken cancellationToken);

    /// <summary>The aggregated public nurse profile for the discovery detail (C3): identity + aggregates +
    /// verification signal + specialty chips + active bookable services + latest published review. NULL when
    /// no such nurse profile exists. Exposes no encrypted credential number.</summary>
    Task<NursePublicProfileDto?> GetPublicProfileAsync(long nurseProfileId, CancellationToken cancellationToken);
}
