// packages/backend/src/modules/netaclaw/browser-daemon/controller/admin/navigation.ts
import { Provide, Inject, Controller, Post, Body } from '@midwayjs/core';
import { CoolTag, CoolUrlTag, TagTypes } from '@cool-midway/core';
import { BrowserDaemonService } from '../../service/daemon.service.js';

@Provide()
@CoolUrlTag()
@Controller('/admin/browser-daemon')
export class AdminBrowserDaemonNavigationController {
  @Inject() daemonService: BrowserDaemonService;

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/goto')
  async goto(@Body() dto: { sessionName: string; url: string }) {
    await this.daemonService.goto(dto.sessionName, dto.url);
    return { code: 1000, data: { navigated: dto.url } };
  }
}
