export interface Enterprise {
  id: string;
  name: string;
  code: string;
  type: string;
  status: 'active' | 'inactive';
  address?: string;
  contact?: string;
  phone?: string;
  createdAt: string;
}

export interface User {
  id: string;
  username: string;
  phone: string;
  email?: string;
  realName: string;
  role: string;
  permissions: string[];
  avatar?: string;
  department?: string;
  enterpriseId: string;
  enterpriseName: string;
  createdAt: string;
  lastLoginTime?: string;
  lastLoginIp?: string;
  lastLoginDevice?: string;
}

export interface LoginForm {
  username?: string;
  password?: string;
  phone?: string;
  code?: string;
  captcha: string;
  loginType: 'password' | 'phone';
}

export interface RegisterForm {
  username: string;
  password: string;
  confirmPassword: string;
  phone: string;
  code: string;
  realName: string;
  email?: string;
  enterpriseId: string;
  captcha: string;
}

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

export interface LoginResponse {
  success: boolean;
  message: string;
  data?: {
    user: User;
    token: string;
    refreshToken: string;
  };
}

export interface LoginRecord {
  id: string;
  userId: string;
  username: string;
  loginTime: string;
  loginIp: string;
  loginDevice: string;
  browser: string;
  os: string;
  loginType: 'password' | 'phone';
  status: 'success' | 'failed';
  failReason?: string;
}