import type { LocalePair } from '../../certification/types/certification';

export type QuestionForm = 'ESSAY' | 'CHOICE';

export interface EstimatedTime {
  days: number;
  hours: number;
  minutes: number;
}

/** Question bank quality control (US-EXAM-003). */
export type QuestionStatus =
  | 'DRAFT'
  | 'PENDING_APPROVAL'
  | 'APPROVED'
  | 'REJECTED'
  | 'RETIRED';

export interface Question {
  id: string;
  certificationId: string;
  certification?: { id: string; name: LocalePair };
  title: LocalePair;
  description: LocalePair;
  form: QuestionForm;
  time: EstimatedTime | null;
  points: number;
  isActive: boolean;
  status: QuestionStatus;
  reviewRemark: string | null;
  reviewedAt: string | null;
  submittedAt: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface ReviewQuestionPayload {
  id: string;
  outcome: 'APPROVED' | 'REJECTED' | 'RETIRED';
  remark?: string;
}

export interface ListResponse<T> {
  total: number;
  items: T[];
}

export interface CreateQuestionPayload {
  certificationId: string;
  title: LocalePair;
  description?: LocalePair;
  form: QuestionForm;
  time?: EstimatedTime;
  points: number;
}

export interface UpdateQuestionPayload {
  id: string;
  certificationId?: string;
  title?: LocalePair;
  description?: LocalePair;
  form?: QuestionForm;
  time?: EstimatedTime;
  points?: number;
  isActive?: boolean;
}
