import { INiceCxoneEvent } from "../../types";
import { IGenericSection } from "../../../generic/types";
import { getMethods } from "../methods";

export const transformDynamicsMessage = (message: INiceCxoneEvent): IGenericSection => {
    const section: IGenericSection = {
        type: 'section',
        children: []
    };

    if (message?.messageContent) section.children.push(getMethods("text")(message?.messageContent));
    if (message?.attachments?.length) section.children.push(getMethods("attachments")(message?.attachments));

    return section;
};