import { IGenericLocation } from '../../../../generic/types';
import { IRWCMessage, IRWCAnswerComponent } from '../../../types';
import { getAnswerComponent } from '../../../helpers/answer-types';

export const transformLocation = ({ props }: IGenericLocation): IRWCMessage => {
  const answerComponent: IRWCAnswerComponent = getAnswerComponent('rwc-location');
  
  const defaultValue = props?.value || answerComponent.defaultValue;
  const buttonLabel = props?.label || "``";

  answerComponent.vBind = {
    defaultValue,
    buttonLabel
  };

  const result: IRWCMessage = {
    answerComponent
  };

  return result;
};