export type Role = 'master-admin' | 'admin' | 'operator';
export type Status = 'active' | 'disabled';

export interface User {
  id: number;
  username: string;
  name: string;
  display_name: string;
  email: string;
  role: Role;
  status: Status;
  is_first_login: boolean;
  needs_2fa_setup: boolean;
  two_factor_devices: number;
  created_by?: string;
  created_at: string;
  updated_at: string;
}

export interface Device {
  id: string;
  name: string;
  added_at: string;
}

export interface AuthState {
  token: string | null;
  user: User | null;
  isAuthenticated: boolean;
}

export type LoginStep =
  | 'credentials'
  | 'first_login'
  | 'setup_2fa'
  | 'otp';

export interface LoginResponse {
  step: LoginStep;
  message: string;
  temp_token?: string;
  token?: string;
  user?: User;
  qr_code?: string;
  secret?: string;
  requires?: string[];
}

export interface PaginatedResponse<T> {
  data: T[];
  current_page: number;
  last_page: number;
  per_page: number;
  total: number;
}

export interface CreateUserPayload {
  username: string;
  name: string;
  email: string;
  password: string;
  role: 'admin' | 'operator';
}

export interface UpdateUserPayload {
  name?: string;
  email?: string;
  status?: Status;
}

export interface SidebarItem {
  key: string;
  label: string;
  icon: string;
  href: string;
  roles: Role[];
  children?: SidebarItem[];
}
