using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.SchemaIntrospection; using Microsoft.Extensions.Logging; namespace GB5Shared.SchemaIntrospection { /// /// Analytics Catalog Wizard (Phase 1) — "own DB" path. Thin wrapper over /// ISchemaIntrospectionDAL: lets a user browse the tenant's OWN database's /// tables/columns/foreign keys (no connection string — same DB the request is already on). /// public class OwnDbSchemaBLL : IOwnDbSchemaBLL { private readonly ISchemaIntrospectionDAL _schemaIntrospectionDAL; private readonly ILogger _logger; public OwnDbSchemaBLL(ISchemaIntrospectionDAL schemaIntrospectionDAL, ILogger logger) { _schemaIntrospectionDAL = schemaIntrospectionDAL ?? throw new ArgumentNullException(nameof(schemaIntrospectionDAL)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); } public async Task> GetOwnDbColumnsAsync(LoginDTO login, CancellationToken ct) { _logger.LogInformation("GetOwnDbColumnsAsync ENTRY | ClientId={ClientId} DatabaseType={DatabaseType}", login?.ClientId, login?.DatabaseType); return await _schemaIntrospectionDAL.GetOwnDbColumnsAsync(login!, ct).ConfigureAwait(false); } public async Task> GetOwnDbForeignKeysAsync(LoginDTO login, CancellationToken ct) { _logger.LogInformation("GetOwnDbForeignKeysAsync ENTRY | ClientId={ClientId} DatabaseType={DatabaseType}", login?.ClientId, login?.DatabaseType); return await _schemaIntrospectionDAL.GetOwnDbForeignKeysAsync(login!, ct).ConfigureAwait(false); } } }