using System.Collections.Immutable; using Connected.Common.Documents; using Connected.Entities; using Connected.Notifications; using Connected.ServiceModel; using ItemOps = Connected.Logistics.Documents.Receive.ReceivePostingItemOps; using Ops = Connected.Logistics.Documents.Receive.ReceivePostingDocumentOps; using PlannedOps = Connected.Logistics.Documents.Receive.ReceivePlannedItemsOps; namespace Connected.Logistics.Documents.Receive; internal sealed class ReceivePostingDocumentService : DocumentService, IReceivePostingDocumentService { public event ServiceEventHandler> PlannedItemUpdated; public ReceivePostingDocumentService(IContext context) : base(context) { } public async Task Delete(PrimaryKeyArgs args) { await Invoke(GetOperation(), args); } public async Task Insert(InsertReceivePostingDocumentArgs args) { return await Invoke(GetOperation(), args); } public async Task InsertItem(InsertReceivePostingItemArgs args) { return await Invoke(GetOperation(), args); } public async Task Patch(PatchArgs args) { if (await Select(args.Id) is not ReceivePostingDocument entity) return; await Update(entity.Merge(args, State.Default).AsArguments()); } public async Task PatchPlanedItem(PatchArgs args) { if (await SelectPlannedItem(args.Id) is not ReceivePlannedItem entity) return; await UpdatePlannedItem(entity.Merge(args, State.Default).AsArguments()); } public async Task> Query(PrimaryKeyArgs args) { return await Invoke(GetOperation(), args); } public async Task> QueryItems(PrimaryKeyArgs args) { return await Invoke(GetOperation(), args); } public async Task> QueryPlannedItems(PrimaryKeyArgs args) { return await Invoke(GetOperation(), args); } public async Task> QueryPlannedItems(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 SelectPlannedItem(PrimaryKeyArgs args) { return await Invoke(GetOperation(), args); } public async Task SelectPlannedItem(SelectReceivePlannedItemArgs args) { return await Invoke(GetOperation(), args); } public async Task Update(UpdateReceivePostingDocumentArgs args) { await Invoke(GetOperation(), args); } public Task UpdatePlannedItem(UpdateReceivePlannedItemArgs args) { throw new NotImplementedException(); } }