namespace inutralia.ViewModels
{
    using inutralia.Models;
    using System.Threading.Tasks;


    public class CreateNutriQuestionViewModel : BaseNavigationViewModel
    {
        public CreateNutriQuestionViewModel()
        {
            Conversation = new Conversation();

        }


        public Conversation Conversation { get; private set; }



        public async Task RefreshData()
        {
            if (Conversation == null)
                return;

            IsBusy = true;

            if (await App.API.RefreshItemAsync(Conversation))
            {
                OnPropertyChanged("Conversation");

                // Cambiar título
                var Caca = Conversation.Subject;
                var Caca2 = Conversation.Created_at;
                var Caca3 = Conversation.State;
                var caca4 = Conversation.Messages[0];

            } //endif

            IsBusy = false;
        }

        public async Task SaveData(string subjectValue, string messageValue)
        {
            IsBusy = true;
            Conversation.Subject = subjectValue;
            Conversation.Message = messageValue;

            await App.API.UpdateItemAsync(Conversation, true);

            IsBusy = false;


        }


    }
}