import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { ExcludePrivilege, Public } from 'src/core/guards';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
import { ReportService } from './report.service';
import { GetReportConfigDto } from '../shared/dto/report-config.get.dto';
import { GetReportDataDto } from '../shared/dto/report-data.get.dto';

@ApiTags(`${MODULE_NAME.REPORT.split('-').join(' ')}`)
@Controller(`v1/${MODULE_NAME.REPORT}`)
@Public(false)
@ApiBearerAuth('JWT')
export class ReportController {
  constructor(private service: ReportService) {}
  @Get('config')
  @ExcludePrivilege()
  async getReportConfig(@Query() query: GetReportConfigDto) {
    return await this.service.getReportConfig(query);
  }

  @Post('data')
  @ExcludePrivilege()
  async getReportData(@Body() body: GetReportDataDto) {
    return await this.service.getReportData(body);
  }

  @Post('meta')
  @ExcludePrivilege()
  async getReportMeta(@Body() body: GetReportDataDto) {
    return await this.service.getReportMeta(body);
  }
}
