export interface Enterprise {
  id: string;
  name: string;
  code: string;
  type: string;
  status: 'active' | 'inactive';
  auditStatus?: 'not_submitted' | 'pending' | 'approved' | 'rejected';
  address?: string;
  contact?: string;
  phone?: string;
  createdAt: string;
  // 企业详细信息字段（用于审核查看）
  province?: string;
  city?: string;
  district?: string;
  companySize?: string;
  registeredCapital?: string;
  establishmentDate?: string;
  invoiceType?: string;
  socialCreditCode?: string;
  businessScope?: string;
  businessLicense?: string;
  bankAccount?: string;
  bankName?: string;
  bankFullName?: string;
  bankAddress?: string;
  bankLicense?: string;
  legalPerson?: string;
  registrant?: string;
  contactPhone?: string;
  idCardFront?: string;
  idCardBack?: string;
  updatedAt?: string;
  auditTime?: string;
  auditor?: string;
  auditReason?: 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;
}
