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

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

interface UserActionsProps {
  user: User;
  onView: (user: User) => void;
  onEdit: (user: User) => void;
  onLock: (user: User) => void;
  onDelete: (user: User) => void;
}

export const UserActions = ({
  user,
  onView,
  onEdit,
  onLock,
  onDelete,
}: UserActionsProps) => {
  return (
    <View className="flex-row justify-center">
      <IconButton icon="eye-outline" onPress={() => onView(user)} size={20} />
      <IconButton
        icon="pencil-outline"
        onPress={() => onEdit(user)}
        size={20}
      />
      <IconButton
        icon="lock-outline"
        onPress={() => onLock(user)}
        size={20}
        iconColor={user.isLocked ? "#F83434" : undefined}
      />
      <IconButton
        icon="delete-outline"
        onPress={() => onDelete(user)}
        size={20}
      />
    </View>
  );
};
