Files
2026-06-26 10:29:23 +02:00

34 lines
2.0 KiB
C#

using adas_core.Domain.Models.DTO;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
namespace adas_core.Application.Services.Interfaces;
public interface IDeviceService
{
/// <summary>
/// Creates a new <see cref="Device"/> from the provided <see cref="DeviceDto"/>.
/// </summary>
/// <param name="device">The data transfer object containing the information used to create the device.</param>
/// <returns>A task that represents the asynchronous create operation. The task result contains the created <see cref="Device"/>, or <see langword="null"/> if the device could not be created.</returns>
Task<Device?> Create(DeviceDto device);
/// <summary>
/// Asynchronously deletes the object identified by the specified identifier.
/// </summary>
/// <param name="objectId">The unique identifier of the object to delete.</param>
/// <returns>A task that represents the asynchronous delete operation. The result is <c>true</c> if the object was deleted; otherwise, <c>false</c>.</returns>
Task<bool> Delete(ObjectId objectId);
/// <summary>
/// Updates an existing device using the provided data transfer object.
/// </summary>
/// <param name="device">The data transfer object containing the updated device information.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the updated device, or <c>null</c> if the device was not found.</returns>
Task<Device?> Update(DeviceDto device);
/// <summary>
/// Processes an incoming event for the specified device and returns the associated <see cref="Device"/>.
/// Returns <c>null</c> when the device referenced by the event cannot be found.
/// </summary>
/// <param name="device">The device data transfer object carrying the event information to be processed.</param>
/// <returns>A task that represents the asynchronous operation, containing the resolved <see cref="Device"/> or <c>null</c> if no matching device was found.</returns>
Task<Device?> ReceiveEvent(DeviceDto device);
}