import { Args, Query, Resolver } from '@nestjs/graphql';
import { TicketValidationState } from '@prisma/client';
import { KpiService } from './kpi.service';
import { KpiInfoObjectType } from './object-types';

@Resolver()
export class KpiResolver {
  constructor(private readonly kpiService: KpiService) {}

  @Query(() => KpiInfoObjectType)
  ticketStateKpi(
    @Args('state', { type: () => TicketValidationState })
    ticketState: TicketValidationState,
  ) {
    return this.kpiService.ticketStateKpi(ticketState);
  }

  @Query(() => KpiInfoObjectType)
  managerKpi(
    @Args('ordinanceType', { type: () => String }) ordinanceType: string,
  ) {
    return this.kpiService.managerKpi(ordinanceType);
  }
}
