export type FaceVerifyPreset = 'relaxed' | 'standard' | 'strict';

export type FaceVerifyNotifyLevel = 'log' | 'alert' | 'lock';

export interface FaceVerifyConfigRow {
  id: number;
  scope: 'global' | 'course' | 'exam';
  course_id: string | null;
  recid: string | null;
  itemid: string | null;
  enabled: boolean;
  preset: FaceVerifyPreset | string;
  similarity_alert_below: number;
  similarity_critical_below: number;
  fail_count_before_notify: number;
  check_interval_sec: number;
  grace_period_start_min: number;
  notify_level: FaceVerifyNotifyLevel;
}

export interface FaceCompareResult {
  similarity: number | null;
  distance: number | null;
  passed: boolean;
  liveFaces: number;
  referenceFaces: number;
  message: string;
}

export interface FaceVerifyCompareResponse {
  enabled: boolean;
  similarity: number | null;
  passed: boolean;
  failStreak: number;
  notified: boolean;
  message: string;
  config: Pick<
    FaceVerifyConfigRow,
    | 'preset'
    | 'similarity_alert_below'
    | 'similarity_critical_below'
    | 'fail_count_before_notify'
    | 'grace_period_start_min'
  >;
}

export interface ExamFaceVerifyContext {
  userId: string;
  userName: string;
  courseId: string;
  recId: string;
  itemId: string;
  snapshotUrl: string;
  device?: string;
}
