using System.Collections.Immutable;
using Connected.Common.Documents;
using Connected.Entities;
using Connected.ServiceModel;
using ItemOps = Connected.Logistics.Documents.Receive.ReceiveDocumentItemOps;
using Ops = Connected.Logistics.Documents.Receive.ReceiveDocumentOps;
namespace Connected.Logistics.Documents.Receive;
///
internal sealed class ReceiveDocumentService : DocumentService, IReceiveDocumentService
{
///
/// Create a new instance
///
/// The DI scope used by this instance.
public ReceiveDocumentService(IContext context) : base(context)
{
}
///
public async Task Delete(PrimaryKeyArgs args)
{
await Invoke(GetOperation(), args);
}
///
public async Task DeleteItem(PrimaryKeyArgs args)
{
await Invoke(GetOperation(), args);
}
///
public async Task Insert(InsertReceiveDocumentArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task InsertItem(InsertReceiveItemArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task Patch(PatchArgs args)
{
if (await Select(args.Id) is not ReceiveDocument entity)
return;
await Update(args.Patch(entity));
}
///
public async Task> Query(QueryArgs? args)
{
return await Invoke(GetOperation(), args ?? QueryArgs.Default);
}
///
public async Task> QueryItems(PrimaryKeyArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task Select(PrimaryKeyArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task SelectItem(PrimaryKeyArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task SelectItem(SelectReceiveItemArgs args)
{
return await Invoke(GetOperation(), args);
}
///
public async Task Update(UpdateReceiveDocumentArgs args)
{
await Invoke(GetOperation(), args);
}
///
public async Task UpdateItem(UpdateReceiveItemArgs args)
{
await Invoke(GetOperation(), args);
}
}