import { FaEye, FaPencil, FaTrashCan } from 'react-icons/fa6';
import { GetProjectActionsProps } from '@/types/project';
import { ActionButton } from '@/src/types/common';

export function getProjectActions({ project, router, setSelectedProjectId }: GetProjectActionsProps): ActionButton[] {
  const actions: ActionButton[] = [];

  if (project.url && project.url.trim() !== '') {
    actions.push({
      icon: <FaEye />,
      text: 'View',
      onClick: () => window.open(project.url!, '_blank'),
    });
  }

  actions.push({
    icon: <FaPencil />,
    text: 'Edit',
    onClick: () => router.push(`/projects/${project.id}`),
  });

  actions.push({
    icon: <FaTrashCan />,
    text: 'Delete',
    onClick: () => setSelectedProjectId(project.id),
  });

  return actions;
}
