using OTSSignsOrchestrator.Core.Models.DTOs;
namespace OTSSignsOrchestrator.Core.Services;
///
/// Abstraction for Docker CLI stack operations (deploy, remove, list, inspect).
/// Implementations may use local docker CLI or SSH-based remote execution.
///
public interface IDockerCliService
{
Task DeployStackAsync(string stackName, string composeYaml, bool resolveImage = false);
Task RemoveStackAsync(string stackName);
Task> ListStacksAsync();
Task> InspectStackServicesAsync(string stackName);
/// Ensures a directory exists on the target host (equivalent to mkdir -p).
Task EnsureDirectoryAsync(string path);
///
/// Ensures the required folders exist on an SMB/CIFS share, creating any that are missing.
/// If is non-empty, creates it first as a subfolder of the share,
/// then creates the volume folders inside it.
/// Uses smbclient on the remote host to interact with the share without requiring a mount.
///
Task EnsureSmbFoldersAsync(
string cifsServer,
string cifsShareName,
string cifsUsername,
string cifsPassword,
IEnumerable folderNames,
string? cifsShareFolder = null);
///
/// Removes all Docker volumes whose names start with _.
/// Volumes currently in use by running containers will be skipped.
/// Safe for CIFS volumes since data lives on the remote share, not in the local volume.
///
Task RemoveStackVolumesAsync(string stackName);
}
public class StackInfo
{
public string Name { get; set; } = string.Empty;
public int ServiceCount { get; set; }
}
public class ServiceInfo
{
public string Name { get; set; } = string.Empty;
public string Image { get; set; } = string.Empty;
public string Replicas { get; set; } = string.Empty;
}