// 静态登录方法
const staticUser = {
  username: 'admin',
  password: 'admin123',
  token: 'static-token',
  userId: 1,
  userName: 'admin',
  avatar: '',
  roles: ['admin'],
  permissions: ['*:*:*']
};

// 登录方法
export function login(username, password, code, uuid) {
  return new Promise((resolve, reject) => {
    if (username === staticUser.username && password === staticUser.password) {
      resolve({ token: staticUser.token });
    } else {
      reject(new Error('账号或密码错误'));
    }
  });
}

// 注册方法（静态页面不实现）
export function register(data) {
  return Promise.reject(new Error('静态页面不支持注册'));
}

// 获取用户详细信息
export function getInfo() {
  return Promise.resolve({
    user: staticUser,
    roles: staticUser.roles,
    permissions: staticUser.permissions
  });
}

// 退出方法
export function logout() {
  return Promise.resolve();
}

// 获取验证码（静态假数据）
export function getCodeImg() {
  return Promise.resolve({
    img: '',
    uuid: 'static-uuid',
    captchaEnabled: false
  });
}