/**
 * Constants for the online-attendance flow: API response messages,
 * log messages, and Swagger summaries. Error strings live in the global error
 * registries (error-string-constants.ts + i18n/error-messages.ts).
 */

/** Success messages returned in the API response envelope. */
export const ONLINE_ATTENDANCE_RESPONSE = {
  JOIN_RESOLVED: 'Join link resolved',
  SESSION_REPORT: 'Session attendance report',
  PROGRAM_REPORT: 'Program attendance report',
  SESSION_REPORT_EXPORT: 'Session attendance export ready',
  PROGRAM_REPORT_EXPORT: 'Program attendance export ready',
  ATTENDANCE_MARKED: 'Attendance marked',
  ATTENDANCE_UNMARKED: 'Attendance unmarked',
  ATTENDANCE_UNDONE: 'Attendance mark undone',
  ATTENDANCE_LOCKED: 'Session attendance locked',
  ATTENDANCE_UNLOCKED: 'Session attendance unlocked',
} as const;

/** Log messages emitted across the online-attendance flow. */
export const ONLINE_ATTENDANCE_LOG = {
  SESSION_FIND_FAILED: 'Error finding session',
  SESSION_SAVE_FAILED: 'Error saving session',
  SESSION_FIND_BY_EXT_FAILED: 'Error finding session by meeting/webinar id',
  SESSIONS_BY_PROGRAM_FAILED: 'Error listing sessions by program',
  CONFIRMED_REG_FIND_FAILED: 'Error finding confirmed registration',
  ATTENDANCE_FIND_BY_ID_FAILED: 'Error finding attendance by id',
  ATTENDANCE_FIND_BY_USER_FAILED: 'Error finding attendance by session+user',
  ATTENDANCE_FIND_BY_EMAIL_FAILED: 'Error finding attendance by session+email',
  ATTENDANCE_SAVE_FAILED: 'Error saving attendance',
  ATTENDANCE_LIST_FAILED: 'Error listing attendance by session',
  ATTENDANCE_FETCH_FAILED: 'Error fetching attendance for session',
  COMPANION_NOT_ELIGIBLE: 'Skipped join-with-others companion: not a confirmed registration of this session',
  ATTENDANCE_MARKED: 'Admin marked attendance',
  ATTENDANCE_ALREADY_MARKED: 'Attendance already marked; mark is a no-op',
  ATTENDANCE_UNMARKED: 'Admin unmarked attendance',
  ATTENDANCE_NOTHING_TO_UNMARK: 'No marked attendance found to unmark; unmark is a no-op',
  RM_SCOPE_NOT_ENFORCED:
    'RM registrant-scope not strictly enforced (no registration→RM id available); allowing mark',
  ATTENDANCE_LOCKED: 'Coordinator locked session attendance',
  ATTENDANCE_UNLOCKED: 'Coordinator unlocked session attendance',
  ZOOM_JOIN_SKIPPED_LOCKED: 'Skipped Zoom webhook attendance write: session attendance is locked',
} as const;

/** Swagger operation summaries / tag for the online-attendance controllers. */
export const ONLINE_ATTENDANCE_SWAGGER = {
  TAG: 'online-attendance',
  JOIN: 'Mark attendance (JOIN_CLICK) and return the session join link',
  SESSION_REPORT: 'Admin: attendance report for a session',
  PROGRAM_REPORT: 'Admin: attendance report aggregated across a program',
  MARK_ATTENDANCE: 'RM/Coordinator: mark a registrant present or absent for an online session',
  UNMARK_ATTENDANCE: 'Admin: clear a registrant\'s attendance for an online session (legacy; prefer undo)',
  UNDO_ATTENDANCE: 'RM/Coordinator: undo your own attendance mark; attendance status recomputes',
  LOCK_ATTENDANCE: 'Coordinator: lock a session\'s attendance so only Coordinators can edit it',
  UNLOCK_ATTENDANCE: 'Coordinator: unlock a session\'s attendance',
} as const;

/** Minutes before a session start that the join link opens when not configured per-session. */
export const JOIN_OPENS_DEFAULT_MINUTES = 15;

/** Minutes of buffer added after the actual/scheduled session end before the join link closes. */
export const JOIN_CLOSES_BUFFER_DEFAULT_MINUTES = 10;

/** Upper bound on co-located companions one primary joiner may credit at once. */
export const MAX_JOIN_COMPANIONS = 25;
