function normalizeKeyword(keyword?: string): string {
  return keyword?.trim() || '';
}

function buildPluginPageQueryParams(categoryId: string, keyword?: string) {
  const normalizedKeyword = normalizeKeyword(keyword);
  return {
    category: categoryId || '0',
    keyword: normalizedKeyword || undefined,
  };
}

function buildPluginToolPageQueryParams(keyword?: string) {
  const normalizedKeyword = normalizeKeyword(keyword);
  return {
    keyword: normalizedKeyword || undefined,
  };
}

export { buildPluginPageQueryParams, buildPluginToolPageQueryParams };
