import {
  Controller,
  Get,
  Put,
  Param,
  Body,
  Query,
  UseGuards,
} from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { AdminOrderService } from './order.service';
import { JwtAuthGuard, RolesGuard } from '@/common';
import { Roles } from '@/common/decorators/roles.decorator';
import { QueryOrderDto } from './dto/order.dto';

@ApiTags('订单管理(管理员)')
@Controller('admin/orders')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('admin')
@ApiBearerAuth()
export class AdminOrderController {
  constructor(private readonly adminOrderService: AdminOrderService) {}

  @Get()
  @ApiOperation({ summary: '全量订单列表' })
  async findAll(@Query() query: QueryOrderDto) {
    return this.adminOrderService.findAll(query);
  }

  @Get(':id')
  @ApiOperation({ summary: '订单详情' })
  async findById(@Param('id') id: number) {
    return this.adminOrderService.findById(id);
  }

  @Get('service-fees/list')
  @ApiOperation({ summary: '服务费记录列表' })
  async getServiceFees(@Query() query: QueryOrderDto) {
    return this.adminOrderService.getServiceFees(query);
  }
}
