using System.Collections.Immutable;
using Connected.Entities;
using Connected.ServiceModel;
using Connected.Services;
using Ops = Logistics.Types.Serials.SerialOps;
namespace Logistics.Types.Serials;
///
internal sealed class SerialService : EntityService, ISerialService
{
///
/// Create a new service.
///
/// The context which serves as a DI scope.
public SerialService(IContext context) : base(context)
{
}
///
public async Task Delete(PrimaryKeyArgs args)
{
await Invoke(GetOperation(), args);
}
///
public async Task Insert(InsertSerialArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task> Query(QueryArgs? args)
{
return await Invoke(GetOperation(), args ?? QueryArgs.Default);
}
///
public async Task> Query(PrimaryKeyListArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task Select(PrimaryKeyArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task Select(SelectSerialArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task Update(UpdateSerialArgs args)
{
await Invoke(GetOperation(), args);
}
///
public async Task Patch(PatchArgs args)
{
if (await Select(args.Id) is not Serial entity)
return;
await Update(args.Patch(entity));
}
}