using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Windows.Controls.ConversationalUI;

namespace chatSimplified
{
    class MessageConverter : IMessageConverter
    {
        public MessageBase ConvertItem(object item)
        {
            var messageModel = (TextMessageObject)item;
            
            TextMessage textMessage = new TextMessage(messageModel.MsgAuthor, messageModel.Text, messageModel.CreationDate);
            return textMessage;
        }

        public object ConvertMessage(MessageBase message)
        {
            
            var textMessage = (TextMessage)message;
            return new TextMessageObject()
            {
                MsgAuthor = textMessage.Author,
                Text = textMessage.Text,
                CreationDate = textMessage.CreationDate
            };
        }
    }
}
