import { Controller, Get, Query, Request } from "@nestjs/common";
import { SupportService } from "./support.service";
import { ZodValidationPipe } from "@customer-portal/validation/nestjs";
import {
  supportCaseFilterSchema,
  type SupportCaseFilter,
  type SupportCaseList,
} from "@customer-portal/domain/support";
import type { RequestWithUser } from "@bff/modules/auth/auth.types";

@Controller("support")
export class SupportController {
  constructor(private readonly supportService: SupportService) {}

  @Get("cases")
  async listCases(
    @Request() _req: RequestWithUser,
    @Query(new ZodValidationPipe(supportCaseFilterSchema))
    filters: SupportCaseFilter
  ): Promise<SupportCaseList> {
    void _req;
    return this.supportService.listCases(filters);
  }
}
