import type { Request, Response } from 'express';
import PersonalityQuizResultsService from '@/services/personality_quiz_results';

export async function getCurrentUserResult(
  req: Request,
  res: Response,
): Promise<void> {
  const payload = await PersonalityQuizResultsService.getCurrentUserResult(
    req.currentUser,
  );
  res.status(200).send(payload);
}

export async function upsertCurrentUserResult(
  req: Request,
  res: Response,
): Promise<void> {
  const payload = await PersonalityQuizResultsService.upsertCurrentUserResult(
    req.body.data,
    req.currentUser,
  );
  res.status(200).send(payload);
}

export async function distribution(req: Request, res: Response): Promise<void> {
  const payload = await PersonalityQuizResultsService.distribution(
    req.query,
    req.currentUser,
  );
  res.status(200).send(payload);
}
