import { type Acknowledgement } from 'src/pages/dashboard/acknowledgements/types';

import PostCardHeader from 'src/components/post/PostCardHeader';

import AcknowledgementMenuActions from '../AcknowledgementMenuActions';

type AcknowledgementCardHeaderProps = {
  acknowledgement: Acknowledgement;
};

const AcknowledgementCardHeader = ({
  acknowledgement,
}: AcknowledgementCardHeaderProps) => {
  const { acknowledger, createdAt } = acknowledgement;
  const isDeleted = !!acknowledger.deleted;

  return (
    <PostCardHeader
      user={acknowledger}
      publicationDatetime={createdAt}
      createdAt={createdAt}
      disableProfileLink={isDeleted}
      action={<AcknowledgementMenuActions acknowledgement={acknowledgement} />}
    />
  );
};

export default AcknowledgementCardHeader;
