export type Role = "controller" | "announcer" | "distribution";
export type AwardStatus = "pending" | "announced" | "collected";
/** standard = nominees + one final winner; list = every person is a winner (Top Ten / Top 100) */
export type AwardKind = "standard" | "list";

export interface UserPublic {
  id: string;
  name: string;
  username: string;
  role: Role;
}

export interface NomineeDto {
  id: string;
  name: string;
  sortOrder: number;
}

export interface CollectionRecordDto {
  id: string;
  awardId: string;
  nomineeId: string;
  nomineeName: string;
  isActualRecipient: boolean;
  kcHandle: string;
  collectedByUserId: string;
  collectedByName: string;
  collectedAt: string;
  updatedAt: string;
}

export interface AwardDto {
  id: string;
  category: string;
  kind: AwardKind;
  /** Final winner (standard) or summary like "10 winners" (list) */
  winnerName: string;
  /** @deprecated use winnerName — kept for older UI snippets */
  recipientName: string;
  nominees: NomineeDto[];
  status: AwardStatus;
  sortOrder: number;
  announcedAt: string | null;
  announcedById: string | null;
  announcedByName: string | null;
  corrected: boolean;
  correctionNote: string | null;
  version: number;
  createdAt: string;
  updatedAt: string;
  /** Certificate pickups — one per person on the category */
  collections: CollectionRecordDto[];
  certificatesTotal: number;
  certificatesCollected: number;
}

export interface CeremonyStateDto {
  currentAwardId: string | null;
  updatedAt: string | null;
}

export interface EditLockDto {
  awardId: string;
  userId: string;
  userName: string;
}

export interface AuditEntryDto {
  id: string;
  awardId: string | null;
  winnerName: string | null;
  recipientName: string | null;
  category: string | null;
  userId: string | null;
  userName: string | null;
  action: string;
  details: Record<string, unknown>;
  createdAt: string;
}

export interface StatsDto {
  total: number;
  pending: number;
  announced: number;
  collected: number;
}

export interface EventSettingsDto {
  name: string;
  eventDate: string;
  venue: string;
  notes: string;
  updatedAt: string;
  archiveConfigured: boolean;
}

export interface ArchiveLogDto {
  id: string;
  eventName: string;
  eventDate: string;
  venue: string;
  localPath: string;
  remoteId: string | null;
  remoteOk: boolean;
  remoteError: string | null;
  awardCount: number;
  certificateCount: number;
  archivedByUserId: string | null;
  createdAt: string;
}

export interface ArchiveResultDto {
  archive: ArchiveLogDto;
  localPath: string;
  remoteOk: boolean;
  remoteId: string | null;
  remoteError: string | null;
}

export interface PresenceDto {
  userId: string;
  userName: string;
  role: Role;
  count: number;
}

export type ConnectionStatus = "connected" | "reconnecting" | "disconnected";
