using adas_core.Domain.Models;
using adas_core.Domain.Models.MongoModels;

namespace adas_core.Application.Repositories.Interfaces;

public interface ISectionRepository : IMongoRepository<Section>
{
    /// <summary>
    /// Retrieves a list of sections associated with the specified patient location.
    /// </summary>
    /// <param name="location">The patient location used to filter the sections.</param>
    /// <returns>A task that represents the asynchronous operation. The task result contains the list of sections matching the specified patient location.</returns>
    Task<List<Section>> FindByLocation(PatientLocation location);
    /// <summary>
    /// Asynchronously retrieves a <see cref="Section"/> by its identifier, returning <c>null</c> when no matching section is found.
    /// </summary>
    /// <param name="id">The identifier of the section to look up.</param>
    /// <returns>A task that represents the asynchronous operation. The task result contains the matching <see cref="Section"/>, or <c>null</c> if no section with the specified identifier exists.</returns>
    Task<Section?> FindById(object id);
    /// <summary>
    /// Asynchronously retrieves the <see cref="Section"/> that matches the specified identifier.
    /// Returns <c>null</c> when no matching section is found.
    /// </summary>
    /// <param name="id">The unique identifier of the section to look up.</param>
    /// <returns>A <see cref="Task{Section}"/> that resolves to the matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
    Task<Section?> FindById(string id);
    /// <summary>
    /// Asynchronously retrieves a <see cref="Section"/> that matches the specified section identifier.
    /// </summary>
    /// <param name="section">The section name or identifier used to look up the matching <see cref="Section"/>.</param>
    /// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="Section"/>, or <c>null</c> if no section is found.</returns>
    Task<Section?> FindBySection(string section);
    /// <summary>
    /// Asynchronously retrieves the <see cref="Section"/> associated with the specified point of care.
    /// </summary>
    /// <param name="pointOfCare">The point of care identifier used to look up the section.</param>
    /// <returns>A task that returns the matching <see cref="Section"/>, or <c>null</c> if no section is found for the given point of care.</returns>
    Task<Section?> FindByPointOfCare(string pointOfCare);
    /// <summary>
    /// Asynchronously retrieves all sections.
    /// </summary>
    /// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="Section"/> items.</returns>
    Task<List<Section>> GetAll();

    /// <summary>
    /// Updates the specified section in the system and returns the updated entity.
    /// </summary>
    /// <param name="section">The section entity containing the updated information.</param>
    /// <returns>A task that represents the asynchronous update operation, containing the updated section, or null if the section was not found.</returns>
    Task<Section?> UpdateSection(Section section);
    //Task<Section?> UpdateSectionItems(Section section);
    //Task<Section?> UpdateSectionConfig(Section section);
    //Section UpdateSectionItems(string sectionId, string group, string boxName, BoxResponse boxUpdated);

    /// <summary>
    /// Inserts a single <see cref="Section"/> into the underlying data store and returns the inserted entity, or <see langword="null"/> if the operation did not produce a result.
    /// </summary>
    /// <param name="section">The <see cref="Section"/> instance to be inserted.</param>
    /// <returns>A <see cref="Task{TResult}"/> that resolves to the inserted <see cref="Section"/>, or <see langword="null"/> if no section was inserted.</returns>
    Task<Section?> InsertOneSection(Section section);
}