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

namespace Baya.Application.Contracts.Persistence;

public interface IPatientRepository
{
    Task AddAsync(Patient patient, CancellationToken cancellationToken);

    /// <summary>Tracked, tenancy-scoped lookup — returns the patient only if it belongs to
    /// <paramref name="customerId"/>, else null (so callers surface a not-found, never a cross-tenant
    /// mutation).</summary>
    Task<Patient?> GetOwnedAsync(long id, long customerId, CancellationToken cancellationToken);

    /// <summary>Paginated, no-tracking projection of the customer's own patients.</summary>
    Task<PagedResult<PatientDto>> ListAsync(long customerId, int page, int pageSize, CancellationToken cancellationToken);

    /// <summary>No-tracking, tenancy-scoped projection of a single owned patient; null if not owned.</summary>
    Task<PatientDto?> GetOwnedProjectedAsync(long id, long customerId, CancellationToken cancellationToken);
}
