

import type { TIssueServiceType } from "@buzzwaretech/types";
import { EIssueServiceType } from "@buzzwaretech/types";
import { observer } from "mobx-react";
// local imports
import { IssueAttachmentItemList } from "../../attachment/attachment-item-list";
import { useAttachmentOperations } from "./helper";

type Props = {
  workspaceSlug: string;
  projectId: string;
  issueId: string;
  disabled: boolean;
  issueServiceType?: TIssueServiceType;
};

export const IssueAttachmentsCollapsibleContent = observer(
  function IssueAttachmentsCollapsibleContent(props: Props) {
    const {
      workspaceSlug,
      projectId,
      issueId,
      disabled,
      issueServiceType = EIssueServiceType.ISSUES,
    } = props;
    // helper
    const attachmentHelpers = useAttachmentOperations(
      workspaceSlug,
      projectId,
      issueId,
      issueServiceType,
    );
    return (
      <IssueAttachmentItemList
        workspaceSlug={workspaceSlug}
        projectId={projectId}
        issueId={issueId}
        disabled={disabled}
        attachmentHelpers={attachmentHelpers}
        issueServiceType={issueServiceType}
      />
    );
  },
);
