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

namespace Baya.Application.Contracts.Persistence;

public interface INurseServiceAreaRepository
{
    Task AddAsync(NurseServiceArea area, CancellationToken cancellationToken);

    /// <summary>Tracked, tenancy-scoped lookup — returns the area only if it belongs to
    /// <paramref name="nurseId"/>, else null.</summary>
    Task<NurseServiceArea?> GetOwnedAsync(long id, long nurseId, CancellationToken cancellationToken);

    /// <summary>Whether the nurse already declared this exact coverage (a NULL <paramref name="districtId"/>
    /// is the whole-city row) — the clean 409 guard ahead of the filtered unique index backstop.</summary>
    Task<bool> DuplicateExistsAsync(long nurseId, long cityId, long? districtId, CancellationToken cancellationToken);

    /// <summary>No-tracking, paginated projection of the nurse's own areas with city/district names and the
    /// "whole city" flag; whole-city rows first, then by id.</summary>
    Task<Models.Common.PagedResult<NurseServiceAreaDto>> ListAsync(long nurseId, int page, int pageSize, CancellationToken cancellationToken);
}
