2026-04-28 18:55:14 -05:00
|
|
|
using Data.SeaHavenIndustries;
|
|
|
|
|
|
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
|
|
|
{
|
2026-07-17 10:36:32 -03:00
|
|
|
public record SiteOptionRow(int Id, string? Code, string? City, string? State);
|
|
|
|
|
|
2026-04-28 18:55:14 -05:00
|
|
|
public interface ILocationDataService
|
|
|
|
|
{
|
|
|
|
|
Task<Locations?> GetByIdAsync(int id);
|
|
|
|
|
Task<Locations?> GetByIdWithDetailsAsync(int id);
|
|
|
|
|
Task<IEnumerable<Locations>> GetAllAsync();
|
|
|
|
|
Task<IEnumerable<Locations>> GetByAccountIdAsync(int accountId);
|
2026-05-06 10:49:33 -05:00
|
|
|
|
|
|
|
|
// Paged results returning DTOs
|
2026-04-28 18:55:14 -05:00
|
|
|
Task<(IEnumerable<Locations> Items, int TotalCount)> GetPagedAsync(int page, int pageSize, string? search = null);
|
2026-05-06 10:49:33 -05:00
|
|
|
|
|
|
|
|
// For addressbook endpoint - returns simplified DTO
|
|
|
|
|
Task<(IEnumerable<object> Items, int TotalCount)> GetAddressbookPagedAsync(int page, int pageSize, string? search = null);
|
|
|
|
|
|
2026-07-17 10:36:32 -03:00
|
|
|
Task<IReadOnlyList<SiteOptionRow>> GetSiteOptionsAsync(string? search = null);
|
|
|
|
|
|
2026-08-26 09:12:48 -03:00
|
|
|
/// <summary>
|
|
|
|
|
/// Exists is false when the row is missing. AccountId is null when the site has no account.
|
|
|
|
|
/// </summary>
|
|
|
|
|
Task<(bool Exists, int? AccountId)> GetAccountScopeAsync(
|
|
|
|
|
int locationId,
|
|
|
|
|
CancellationToken cancellationToken = default);
|
|
|
|
|
|
2026-04-28 18:55:14 -05:00
|
|
|
Task<Locations> AddAsync(Locations location);
|
|
|
|
|
Task UpdateAsync(Locations location);
|
|
|
|
|
Task DeleteAsync(int id);
|
|
|
|
|
Task<bool> ExistsAsync(int id);
|
|
|
|
|
Task<int> CountAsync();
|
2026-07-24 17:35:34 -03:00
|
|
|
|
|
|
|
|
Task<(List<Locations> Items, int TotalCount)> GetListPagedAsync(int page, int pageSize, string? search, CancellationToken cancellationToken);
|
|
|
|
|
Task<Locations?> GetDetailByIdAsync(int id, CancellationToken cancellationToken);
|
|
|
|
|
Task<Locations?> GetByIdForUpdateAsync(int id, CancellationToken cancellationToken);
|
|
|
|
|
Task<Locations> AddAsync(Locations location, CancellationToken cancellationToken);
|
|
|
|
|
Task UpdateAsync(Locations location, CancellationToken cancellationToken);
|
|
|
|
|
Task<bool> DeleteByIdAsync(int id, CancellationToken cancellationToken);
|
2026-04-28 18:55:14 -05:00
|
|
|
}
|
|
|
|
|
}
|