using Tiku.Application.Auth;
using Tiku.Application.Notifications;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
using Tiku.Infrastructure.Persistence;

namespace Tiku.Infrastructure.TenantAdmin;

internal sealed record TenantAdminServiceDependencies(
    IIdentityPersistence IdentityPersistence,
    ITenancyPersistence TenancyPersistence,
    ITenantAdministrationPersistence TenantAdministrationPersistence,
    ICatalogPersistence CatalogPersistence,
    ILearningPersistence LearningPersistence,
    ICommercePersistence CommercePersistence,
    IPointsPersistence PointsPersistence,
    IJobsOperationsPersistence JobsOperationsPersistence,
    ITenantExternalProviderConfigService ProviderConfigService,
    INotificationProvider NotificationProvider,
    ICurrentAccessContext CurrentAccessContext,
    IAuthSessionStore SessionStore,
    IFeatureAccessService FeatureAccessService,
    IAuthorizationStateInvalidator AuthorizationStateInvalidator);

internal abstract partial class TenantAdminServiceBase(TenantAdminServiceDependencies dependencies)
{
    protected IIdentityPersistence identityPersistence { get; } = dependencies.IdentityPersistence;
    protected ITenancyPersistence tenancyPersistence { get; } = dependencies.TenancyPersistence;

    protected ITenantAdministrationPersistence tenantAdministrationPersistence { get; } =
        dependencies.TenantAdministrationPersistence;

    protected ICatalogPersistence catalogPersistence { get; } = dependencies.CatalogPersistence;
    protected ILearningPersistence learningPersistence { get; } = dependencies.LearningPersistence;
    protected ICommercePersistence commercePersistence { get; } = dependencies.CommercePersistence;
    protected IPointsPersistence pointsPersistence { get; } = dependencies.PointsPersistence;
    protected IJobsOperationsPersistence jobsOperationsPersistence { get; } = dependencies.JobsOperationsPersistence;
    protected IModulePersistence unitOfWork { get; } = dependencies.TenantAdministrationPersistence;
    protected ITenantExternalProviderConfigService providerConfigService { get; } = dependencies.ProviderConfigService;
    protected INotificationProvider notificationProvider { get; } = dependencies.NotificationProvider;
    protected ICurrentAccessContext currentAccessContext { get; } = dependencies.CurrentAccessContext;
    protected IAuthSessionStore sessionStore { get; } = dependencies.SessionStore;
    protected IFeatureAccessService featureAccessService { get; } = dependencies.FeatureAccessService;

    protected IAuthorizationStateInvalidator authorizationStateInvalidator { get; } =
        dependencies.AuthorizationStateInvalidator;
}
