import type { Router } from 'vue-router';

interface NavigationActionOptions {
  router: Router;
  selectedStoreId: { value: string };
}

/**
 * 文件职责：客户列表页导航动作。
 */
export function createNavigationActions(options: NavigationActionOptions) {
  function openProfilePage(customerKey: string) {
    if (!customerKey) {
      return;
    }

    const query: Record<string, string> = {
      customerKey,
    };
    if (options.selectedStoreId.value) {
      query.storeId = options.selectedStoreId.value;
    }

    void options.router.push({
      path: '/customer/profile',
      query,
    });
  }

  return {
    openProfilePage,
  };
}
