import { IGenericSelect, IGenericSection } from '../../../generic/types';
import { IOption, IBoolean } from '../../types';

import { transformText } from './text';
import { transformMenuOptions } from './options';


export const transformBoolean = (msg: IBoolean): IGenericSection => {
  const result: IGenericSection = {
    type: 'section',
    children: []
  };
  const text = msg.label;
  if (text) {
    result.children.push(transformText(text));
  }

  const options: Array<IOption> = [
    { label: "Yes", value: "true" },
    { label: "No", value: "false" }
  ];

  const selectSection: IGenericSelect = {
    type: 'select',
    props: {
      options: transformMenuOptions(options)
    }
  };
  result.children.push(selectSection);

  return result;
};