export type EventType = 'clock_in' | 'clock_out' | 'break_start' | 'break_end';
export type LiveStatus = 'clocked_out' | 'working' | 'on_break';
export type Role = 'admin' | 'employee';

export interface SessionUser {
  email: string;
  name: string | null;
  role: Role;
  employeeId: number | null;
}

export interface Employee {
  id: number;
  email: string;
  name: string | null;
  active: 0 | 1;
  created_at: string;
}

export interface AttendanceEvent {
  id: number;
  employee_id: number;
  type: EventType;
  ts: string;
}

export interface Session {
  clockIn: string;
  clockOut: string | null;
  breaks: { start: string; end: string | null }[];
  workedMs: number;
  breakMs: number;
  open: boolean;
}

export interface StatsSummary {
  range: { from: string; to: string };
  sessions: Session[];
  totalWorkedMs: number;
  totalBreakMs: number;
  shiftCount: number;
}

export interface EmployeeStat {
  employee: Employee;
  totalWorkedMs: number;
  totalBreakMs: number;
  shiftCount: number;
}

export interface AdminStatsSummary {
  range: { from: string; to: string };
  totals: { totalWorkedMs: number; totalBreakMs: number; shiftCount: number };
  employees: EmployeeStat[];
}
