shoc-backend/SeaHaven.DataServices/Interfaces/IServicesRegistryDataService.cs
2026-09-16 17:07:59 -03:00

39 lines
1.9 KiB
C#

using Data.SeaHavenIndustries;
using Data.SeaHavenIndustries.Enums;
namespace SeaHaven.DataServices.Interfaces
{
// Read-side projection for the global Services registry. The linked
// completion template is projected to id/name only — full template
// entities are never materialized.
public class ServiceRegistryRow
{
public int Id { get; set; }
public string Name { get; set; } = "";
public string Trade { get; set; } = "";
public string IconKey { get; set; } = "";
public bool RequiresCompletionDocument { get; set; }
public bool IsActive { get; set; }
public int? CompletionDocTemplateId { get; set; }
public string? CompletionDocTemplateName { get; set; }
public List<WorkOrderType> SupportedWorkOrderTypes { get; set; } = new();
}
public class LinkedTemplateSummary
{
public int Id { get; set; }
public string Name { get; set; } = "";
}
public interface IServicesRegistryDataService
{
Task<IReadOnlyList<ServiceRegistryRow>> GetServiceRowsAsync(bool? isActive, WorkOrderType? workOrderType, CancellationToken cancellationToken);
Task<ServiceRegistryRow?> GetServiceRowByIdAsync(int id, CancellationToken cancellationToken);
Task<Service?> GetServiceForUpdateAsync(int id, CancellationToken cancellationToken);
Task<bool> NormalizedNameExistsAsync(string normalizedName, int? excludeServiceId, CancellationToken cancellationToken);
Task<LinkedTemplateSummary?> GetActiveTemplateSummaryAsync(int templateId, CancellationToken cancellationToken);
Task<Service> AddServiceAsync(Service service, CancellationToken cancellationToken);
Task SaveServiceAsync(Service service, IReadOnlyCollection<WorkOrderType> supportedWorkOrderTypes, CancellationToken cancellationToken);
Task<bool> DeactivateServiceAsync(int id, CancellationToken cancellationToken);
}
}