using GB5Shared.DTO.Framework.Login;
using SwDAL.DTO.RolloutCampaign;
namespace SwBLL.RolloutCampaign;
public interface IRolloutCampaignBLL
{
/// Resolves the target set per dto.TargetScope, creates the campaign row plus one
/// RolloutTarget row per resolved ClientDbId. Returns the new RolloutCampaignId.
Task CreateCampaignAsync(RolloutCampaignDTO dto, LoginDTO login, CancellationToken ct);
Task GetCampaignStatusAsync(int rolloutCampaignId, LoginDTO login, CancellationToken ct);
/// Flat, unpaginated list of every campaign for this tenant, newest first — for
/// an admin browse screen. Realistic volume per tenant is small (see GET_LIST's own
/// comment).
Task> GetListAsync(LoginDTO login, CancellationToken ct);
/// Per-target status/error detail for one campaign — the drill-down an admin needs
/// to Defer/Skip a specific target (both need a real RolloutTargetId, only discoverable
/// from this list).
Task> GetTargetsAsync(int rolloutCampaignId, LoginDTO login, CancellationToken ct);
/// Explicitly delay one target — independent of every other target in the same
/// campaign and of the campaign's own ScheduledStartOn.
Task DeferTargetAsync(int rolloutTargetId, DateTime deferredUntil, LoginDTO login, CancellationToken ct);
/// Permanently excludes one target from this campaign — never retried by it. Does
/// not affect whether that same client database is included in a future campaign.
Task SkipTargetAsync(int rolloutTargetId, LoginDTO login, CancellationToken ct);
/// The operator's own confirmation that they ran SwOfflineApply successfully for a
/// target sitting AwaitingManualApply (tracker §53) — only valid from that status. Moves it
/// to Applied, letting the campaign's own rollup finally consider it done.
Task MarkManuallyAppliedAsync(int rolloutTargetId, LoginDTO login, CancellationToken ct);
/// Worker entry point (called by RolloutCampaignWorkerJob) — finds every target
/// currently due (Pending, or Deferred with DeferredUntil passed, on a campaign whose own
/// ScheduledStartOn has arrived) and applies each one, updating status as it goes. Returns
/// the number of targets processed this pass.
Task ProcessDueTargetsAsync(LoginDTO login, CancellationToken ct);
}