import { View } from "react-native";
import { IconButton } from "react-native-paper";

import { User } from "@/store/models/User.model";

interface AdminActionsProps {
  admin: User;
  onView: (admin: User) => void;
  onEdit: (admin: User) => void;
  onDelete: (admin: User) => void;
  onResend: (admin: User) => void;
  isResending?: boolean;
}

export const AdminActions = ({
  admin,
  onView,
  onEdit,
  onDelete,
  onResend,
  isResending,
}: AdminActionsProps) => {
  return (
    <View className="flex-row justify-center">
      <IconButton icon="eye-outline" onPress={() => onView(admin)} size={20} />
      {!admin.isActivated && (
        <IconButton
          icon="email-send-outline"
          onPress={() => onResend(admin)}
          size={20}
          disabled={Boolean(isResending)}
          accessibilityLabel="Resend invitation"
        />
      )}
      <IconButton
        icon="pencil-outline"
        onPress={() => onEdit(admin)}
        size={20}
      />
      <IconButton
        icon="delete-outline"
        onPress={() => onDelete(admin)}
        size={20}
      />
    </View>
  );
};
