import _variants from "@/components/ui/button/_variants";
import { RenameFileSchema } from "@/schemas/files/_renameFile";
import { FormBuilderElement } from "@/types/app-component-formbuilder";
import { faHome } from "@fortawesome/free-solid-svg-icons";

type Field = FormBuilderElement<RenameFileSchema, typeof _variants>;

type RenameFileFormFieldsProps = {
  closeModal: (id: string) => void;
  isPending: boolean;
  dict: Dictionary;
};
export default function getRenameFileFormFields({
  closeModal,
  isPending,
  dict,
}: RenameFileFormFieldsProps) {
  return [
    {
      type: "text",
      label: "Path",
      icon: faHome,
      className: "w-full",
      name: "path",
    },
    {
      type: "text",
      label: "Name",
      className: "w-full",
      name: "name",
    },
    {
      type: "group",
      className: "mt-4 flex w-full justify-end gap-2",
      fields: [
        {
          type: "button",
          label: dict.pages.general.close,
          variant: "solid",
          color: "danger",
          onClick: () => closeModal("rename-project-file"),
        },
        {
          type: "submit",
          label: dict.pages.general.rename,
          variant: "solid",
          color: "primary",
          disabled: isPending,
        },
      ],
    },
  ] as Field[];
}
