/**
 * @aurora-catalyst-generated
 * @source cliter/iam
 */
import { IamHandlers, IamModels, IamRepositories, IamServices } from '@app/iam';
import { SharedModule } from '@aurora/shared.module';
import { IamAccountLoaderAdapter } from '@bridges/iam/account';
import { IamBoundedContextSeederAdapter } from '@bridges/iam/bounded-context';
import { IamPermissionSeederAdapter } from '@bridges/iam/permission';
import { IamCredentialVerifierAdapter } from '@bridges/iam/user';
import { Module } from '@nestjs/common';
import { SequelizeModule } from '@nestjs/sequelize';
import { IamAccountApiControllers, IamAccountApiResolvers } from './account';
import { IamBoundedContextApiControllers, IamBoundedContextApiResolvers } from './bounded-context';
import { IamBootstrapSeeder } from './iam-bootstrap.seeder';
import { IamSeeder } from './iam.seeder';
import { IamPermissionApiControllers, IamPermissionApiResolvers } from './permission';
import { IamPermissionRoleApiControllers, IamPermissionRoleApiResolvers } from './permission-role';
import { IamRoleApiControllers, IamRoleApiResolvers } from './role';
import { IamRoleAccountApiControllers, IamRoleAccountApiResolvers } from './role-account';
import { IamTagApiControllers, IamTagApiResolvers } from './tag';
import { IamTenantApiControllers, IamTenantApiResolvers } from './tenant';
import { IamTenantAccountApiControllers, IamTenantAccountApiResolvers } from './tenant-account';
import { IamUserApiControllers, IamUserApiResolvers } from './user';

@Module({
  imports: [SharedModule, SequelizeModule.forFeature([...IamModels])],
  controllers: [
    ...IamTagApiControllers,
    ...IamBoundedContextApiControllers,
    ...IamPermissionApiControllers,
    ...IamPermissionRoleApiControllers,
    ...IamRoleApiControllers,
    ...IamRoleAccountApiControllers,
    ...IamAccountApiControllers,
    ...IamTenantAccountApiControllers,
    ...IamTenantApiControllers,
    ...IamUserApiControllers,
  ],
  providers: [
    IamSeeder,
    IamBootstrapSeeder,
    ...IamHandlers,
    ...IamServices,
    ...IamRepositories,
    ...IamTagApiResolvers,
    ...IamBoundedContextApiResolvers,
    ...IamPermissionApiResolvers,
    ...IamPermissionRoleApiResolvers,
    ...IamRoleApiResolvers,
    ...IamRoleAccountApiResolvers,
    ...IamAccountApiResolvers,
    ...IamTenantAccountApiResolvers,
    ...IamTenantApiResolvers,
    ...IamUserApiResolvers,
    // Manually maintained — zero-leak cross-BC pattern (see skill catalyst-cross-bounded-context-ports).
    // The adapter files live in @bridges/iam/<module>/adapters/ (the canonical cross-BC home,
    // which IS part of the iam BC) but are REGISTERED here in IamModule, not in BridgesModule.
    // This lets them inject internal iam services (IamFindUserByUsernamePasswordService,
    // IamFindAccountService) intra-module — no leaky exports needed. Only the adapters are
    // exported below; BridgesModule's bridge providers map the port tokens via `useExisting`.
    IamCredentialVerifierAdapter,
    IamAccountLoaderAdapter,
    IamBoundedContextSeederAdapter,
    IamPermissionSeederAdapter,
  ],
  exports: [
    IamCredentialVerifierAdapter,
    IamAccountLoaderAdapter,
    IamBoundedContextSeederAdapter,
    IamPermissionSeederAdapter,
  ],
})
export class IamModule {}
