// 用户类型枚举
export type UserType = 'admin' | 'manager' | 'customer'

// 性别类型
export type Gender = 'male' | 'female'

// 用户信息接口
export interface UserInfo {
  accountId: number
  accountName: string
  accountType: UserType
  accountPhone?: string
  accountGender?: Gender
  accountImg?: string | null
}

// 登录请求接口
export interface LoginRequest {
  accountName: string
  accountPassword: string
}

// 注册请求接口
export interface RegisterRequest {
  accountName: string
  accountPassword: string
  confirmPassword: string
  accountPhone?: string
  accountType: UserType
  accountGender?: Gender
}

// 修改密码请求接口
export interface ChangePasswordRequest {
  oldPassword: string
  newPassword: string
  confirmPassword: string
}

// API响应基础接口
export interface ApiResponse<T = any> {
  code: number
  msg: string
  data: T
}

// 登录响应数据
export interface LoginResponseData {
  token: string
  accountInfo: UserInfo
}

// 认证状态接口
export interface AuthState {
  isAuthenticated: boolean
  token: string | null
  userInfo: UserInfo | null
  userType: UserType | null
}

// 路由权限配置
export interface RoutePermission {
  path: string
  allowedRoles: UserType[]
  requiresAuth: boolean
}

// 表单验证规则
export interface ValidationRule {
  required?: boolean
  message?: string
  pattern?: RegExp
  min?: number
  max?: number
  validator?: (value: string) => boolean | string
}

// 表单验证规则集合
export interface FormValidationRules {
  accountName: ValidationRule[]
  accountPassword: ValidationRule[]
  confirmPassword?: ValidationRule[]
  accountPhone?: ValidationRule[]
}
