import { IGenericAttachments } from "../../../generic/types";
import { IMSTeamsAttachment } from "../../types";

export const transformFileUpload = ({ props }: IGenericAttachments): Array<IMSTeamsAttachment> => {
    const attachments = props?.value?.staticValue || props?.value?.filesValue;

    return attachments.reduce((acc, attachment) => {
        const { value } = acc;
        attachment.contentUrl = attachment.text;

        value.push({ contentUrl: attachment.text });

        return {...acc, value};
    }, 
        {type: "attachments", value: []}
    );
};
