using System;
using System.Threading.Tasks;
namespace ClaudeDo.Ui.Services;
///
/// Single entry point for handing a conflicting merge to the in-app 3-pane resolver.
/// Replaces the per-VM RequestConflictResolution Func seams that used to be
/// hand-threaded shell → details → merge-section → diff → merge-modal. The shell wires
/// once at composition; invokers depend only on
/// this interface (injected via DI).
///
public interface IMergeCoordinator
{
Task ResolveConflictAsync(string taskId, string targetBranch);
}
///
/// DI singleton holding the resolver entry. The holder breaks the shell↔island construction
/// cycle: islands depend on the interface, the shell sets after it is built.
///
public sealed class MergeCoordinator : IMergeCoordinator
{
/// Set once at composition to the shell's resolver entry. Null (headless/tests) ⇒ no-op.
public Func? Handler { get; set; }
public Task ResolveConflictAsync(string taskId, string targetBranch) =>
Handler?.Invoke(taskId, targetBranch) ?? Task.CompletedTask;
}