/**
 * 🔐 Interfaces pour l'authentification et autorisation
 * Utilisé par AuthenticationService
 */

export interface User {
  id: string;
  username: string;
  email: string;
  fullname?: string;
  firstname?: string;
  lastname?: string;
  role: string;
  permissions: string[];
  avatar?: string;
  lastLogin?: Date;
  isActive: boolean;
  account_id?: number | null;
  account_uuid?: string | null;
  account_name?: string | null;
}

export interface AuthToken {
  accessToken: string;
  refreshToken?: string;
  expiresAt: number;
  tokenType: string;
  scope?: string[];
}

export interface LoginCredentials {
  username: string;
  password: string;
}

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

export interface TokenStorage {
  getToken(): AuthToken | null;
  setToken(token: AuthToken): void;
  removeToken(): void;
  isTokenValid(token?: AuthToken): boolean;
}

export interface Permission {
  id: string;
  name: string;
  description: string;
  resource: string;
  action: string;
}

export interface Role {
  id: string;
  name: string;
  description: string;
  permissions: Permission[];
}