import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { OrganizationsController } from '../controllers/organizations.controller';

// Import domain ports
import { ORGANIZATION_REPOSITORY } from '@domain/ports/out/organization.repository';
import { TypeOrmOrganizationRepository } from '../../infrastructure/persistence/typeorm/repositories/typeorm-organization.repository';
import { OrganizationOrmEntity } from '../../infrastructure/persistence/typeorm/entities/organization.orm-entity';

@Module({
  imports: [
    TypeOrmModule.forFeature([OrganizationOrmEntity]), // 👈 This line registers the repository provider
  ],
  controllers: [OrganizationsController],
  providers: [
    {
      provide: ORGANIZATION_REPOSITORY,
      useClass: TypeOrmOrganizationRepository,
    },
  ],
  exports: [
    ORGANIZATION_REPOSITORY, // optional, if other modules need it
  ],
})
export class OrganizationsModule {}
