import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { ConfigService } from '@nestjs/config';
import { PublicController } from './public.controller';
import { TagsController } from './tags.controller';
import { ContentReviewController } from './content-review.controller';
import { PublicService } from './public.service';
import { UserWorksService } from './user-works.service';
import { CreationService } from './creation.service';
import { TagsService } from './tags.service';
import { GalleryService } from './gallery.service';
import { ContentReviewService } from './content-review.service';
import { PrismaModule } from '../prisma/prisma.module';

@Module({
  imports: [
    PrismaModule,
    JwtModule.registerAsync({
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        secret: config.get<string>('JWT_SECRET') || 'your-secret-key',
        signOptions: { expiresIn: '7d' },
      }),
    }),
  ],
  controllers: [PublicController, TagsController, ContentReviewController],
  providers: [PublicService, UserWorksService, CreationService, TagsService, GalleryService, ContentReviewService],
  exports: [PublicService, UserWorksService, CreationService, TagsService, GalleryService, ContentReviewService],
})
export class PublicModule {}
