import { IGenericSection, IGenericButton } from "../../../../generic/types";
import { IRWCAnswerComponent } from "../../../types";

export const transformButtonList = (msg: IRWCAnswerComponent): IGenericSection => {
  const btns = msg.vBind?.options || [];
  const children: Array<IGenericButton> = btns.map(btn => ({
    type: 'button',
    props: {
      label: btn.label,
      value: btn.value,
      rwc: {
        buttonStyle: btn.buttonStyle
      }
    }
  }));

  const result: IGenericSection = {
    type: 'section',
    children
  };

  return result;
};
