import _variants from "@/components/ui/button/_variants";
import { UploadFilesSchema } from "@/schemas/files/_uploadfiles";
import { FormBuilderElement } from "@/types/app-component-formbuilder";
import { faHome } from "@fortawesome/free-solid-svg-icons";

type Field = FormBuilderElement<UploadFilesSchema, typeof _variants>;

type UploadFilesFormFieldsProps = {
  closeModal: (id: string) => void;
  isPending: boolean;
  dict: Dictionary;
};
export default function getUploadFilesFormFields({
  closeModal,
  isPending,
  dict,
}: UploadFilesFormFieldsProps) {
  return [
    {
      type: "text",
      label: "Path",
      icon: faHome,
      className: "w-full",
      name: "path",
    },
    {
      type: "file",
      label: dict.pages.general.files,
      name: "files",
      className: "h-[150px]",
      multiple: true,
      errors: dict.pages.project_files.forms.fields.files.errors,
    },
    {
      type: "group",
      className: "w-full flex justify-end gap-4",
      fields: [
        {
          type: "button",
          label: dict.pages.general.close,
          variant: "solid",
          color: "danger",
          onClick: () => closeModal("upload-project-files"),
          required: true,
        },
        {
          type: "submit",
          label: dict.pages.general.upload,
          variant: "solid",
          color: "primary",
          disabled: isPending,
          required: true,
        },
      ],
    },
  ] as Field[];
}
