namespace ZB.MOM.WW.MxGateway.Server.Galaxy;

/// <summary>
///     Abstraction over <see cref="GalaxyRepository"/> consumed by
///     <see cref="GalaxyHierarchyCache"/>. Exists so the cache can be unit-tested
///     against an in-memory fake that throws a <see cref="System.Exception"/>
///     from <see cref="GetLastDeployTimeAsync"/> (the unavailable-backend code
///     path) without standing up a real <c>Microsoft.Data.SqlClient</c>
///     <c>SqlConnection</c> against a bogus host/port. The production gateway
///     wires the concrete <see cref="GalaxyRepository"/>; the SQL surface itself
///     stays covered by <c>ZB.MOM.WW.MxGateway.IntegrationTests.Galaxy.GalaxyRepositoryLiveTests</c>.
/// </summary>
public interface IGalaxyRepository
{
    /// <summary>Tests the connection to the Galaxy Repository database.</summary>
    /// <param name="ct">Token to cancel the asynchronous operation.</param>
    Task<bool> TestConnectionAsync(CancellationToken ct = default);

    /// <summary>Retrieves the last deployment time from the Galaxy Repository.</summary>
    /// <param name="ct">Token to cancel the asynchronous operation.</param>
    Task<DateTime?> GetLastDeployTimeAsync(CancellationToken ct = default);

    /// <summary>Retrieves the complete hierarchy of Galaxy objects from the repository.</summary>
    /// <param name="ct">Token to cancel the asynchronous operation.</param>
    Task<List<GalaxyHierarchyRow>> GetHierarchyAsync(CancellationToken ct = default);

    /// <summary>Retrieves all attributes for Galaxy objects from the repository.</summary>
    /// <param name="ct">Token to cancel the asynchronous operation.</param>
    Task<List<GalaxyAttributeRow>> GetAttributesAsync(CancellationToken ct = default);
}
