import { Module } from '@nestjs/common';
import { PrismaModule } from '@core/database/prisma/prisma.module';
import { InternalAppPlatformController } from './internal-app-platform.controller';
import { InternalAppMcpController } from './mcp.controller';
import { InternalAppPlatformService } from './internal-app-platform.service';
import { InternalAppTokenService } from './services/token.service';
import { InternalAppSlugService } from './services/slug.service';
import { InternalAppMcpToolsService } from './services/mcp-tools.service';
import { InternalAppEnvCryptoService } from './services/env-crypto.service';
import { GiteaClientService } from './services/gitea-client.service';
import { ContainerHostService } from './services/container-host.service';
import { GiteaWebhookService } from './services/webhook.service';
import { InternalAppEventsService } from './services/events.service';
import { GiteaWebhookController } from './webhook.controller';
import { InternalAppAdminController } from './admin.controller';

/**
 * 内部小工具自助部署平台模块
 *
 * 让非技术员工（HR / 运营 / 财务）通过 Claude Code 对话部署内部小工具：
 * 1. FF AI Workspace 接入页颁发 bearer token + 复制 `/mcp add` 命令
 * 2. Claude Code 远程 MCP 调用 deploy_prepare / logs / env / list / destroy 工具
 * 3. 员工本地 `git push` 推到 Gitea → webhook → 平台部署 → 同事拿 URL
 *
 * 详见 docs/modules/internal-app-platform/
 */
@Module({
  imports: [PrismaModule],
  controllers: [
    InternalAppPlatformController,
    InternalAppMcpController,
    GiteaWebhookController,
    InternalAppAdminController,
  ],
  providers: [
    InternalAppPlatformService,
    InternalAppTokenService,
    InternalAppSlugService,
    InternalAppMcpToolsService,
    InternalAppEnvCryptoService,
    GiteaClientService,
    ContainerHostService,
    GiteaWebhookService,
    InternalAppEventsService,
  ],
  exports: [InternalAppPlatformService, InternalAppEventsService],
})
export class InternalAppPlatformModule {}
