import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { BlogController } from '../controllers/blog.controller';
import { BlogService } from '../services/blog.service';
import { BlogPostOrmEntity } from '../../infrastructure/persistence/typeorm/entities/blog-post.orm-entity';
import { TypeOrmBlogPostRepository } from '../../infrastructure/persistence/typeorm/repositories/typeorm-blog-post.repository';
import { BLOG_POST_REPOSITORY } from '@domain/ports/out/blog-post.repository';
import { StorageModule } from '../../infrastructure/storage/storage.module';

@Module({
  imports: [TypeOrmModule.forFeature([BlogPostOrmEntity]), StorageModule],
  controllers: [BlogController],
  providers: [
    BlogService,
    {
      provide: BLOG_POST_REPOSITORY,
      useClass: TypeOrmBlogPostRepository,
    },
  ],
  exports: [BlogService],
})
export class BlogModule {}
