import { Controller, Post, Body, Req } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { InitializationService } from '../../application/services/initialization.service';

class InitMiningConfigDto {
  totalShares: string;
  distributionPool: string;
  halvingPeriodYears: number;
  burnTarget: string;
}

@ApiTags('Initialization')
@ApiBearerAuth()
@Controller('initialization')
export class InitializationController {
  constructor(private readonly initService: InitializationService) {}

  @Post('mining-config')
  @ApiOperation({ summary: '初始化挖矿配置' })
  async initMiningConfig(@Body() dto: InitMiningConfigDto, @Req() req: any) {
    return this.initService.initializeMiningConfig(req.admin.id, dto);
  }

  @Post('system-accounts')
  @ApiOperation({ summary: '初始化系统账户' })
  async initSystemAccounts(@Req() req: any) {
    return this.initService.initializeSystemAccounts(req.admin.id);
  }

  @Post('activate-mining')
  @ApiOperation({ summary: '激活挖矿' })
  async activateMining(@Req() req: any) {
    return this.initService.activateMining(req.admin.id);
  }
}
