using System.Threading.Tasks;
using inutralia.Models;
using inutralia.Models.Questions;

namespace inutralia.ViewModels
{
    public class PendingReadViewModel : BaseNavigationViewModel
    {
        public enum Estatus
        {
            Pendiente = 1,
            Respondida_por_cliente = 2,
            Respondida_por_nutricionista = 3,
            Cerrado = 4
        }

        public PendingReadViewModel(Message message)
        {
            Message = message;

            Title = message?.StatusImg;
        }

        public PendingReadViewModel() { }

        public Message Message { private set; get; }

        public int StateId => Message.StateId;

        public Estatus estatus => (Estatus)Message?.StateId;

        public async Task RefresData()
        {
            if (Message == null)
                return;

            IsBusy = true;

            if (await App.API.RefreshItemAsync(Message))
            {
                Title = Message.StatusImg;
                OnPropertyChanged("");
            }

            IsBusy = false;
        }
    }
}
