import { IGenericScheduler } from "../../../../generic/types";
import { IRWCAnswerComponent } from '../../../types';
import { RWCAnswerComponent } from '../../../classes/v5';

export const transformScheduler = ({ props }: IGenericScheduler): IRWCAnswerComponent => {
    const [workingHours, allowMultiselect] = [props.value, props.multiple];

    const options = props.options.map(({ label, value }) => ({ label, value }));

    const result = {
        workingHours,
        allowMultiselect,
        options,
        ...props.rwc
    };

    return new RWCAnswerComponent(result, 'rwc-scheduler');
};