using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace PolyTraderSharp.Models
{
    public class JobStatusRow : INotifyPropertyChanged
    {
        private string _jobName = "";
        private string _description = "";
        private bool _isEnabled = true;
        private DateTime? _lastRun;
        private DateTime? _nextRun;
        private string _statusText = "Initializing...";

        public string JobName { get => _jobName; set { _jobName = value; OnPropertyChanged(); } }
        public string Description { get => _description; set { _description = value; OnPropertyChanged(); } }
        public bool IsEnabled { get => _isEnabled; set { _isEnabled = value; OnPropertyChanged(); } }
        public DateTime? LastRun { get => _lastRun; set { _lastRun = value; OnPropertyChanged(); } }
        public DateTime? NextRun { get => _nextRun; set { _nextRun = value; OnPropertyChanged(); } }
        public string StatusText { get => _statusText; set { _statusText = value; OnPropertyChanged(); } }

        public Func<Task>? ManualTriggerAction { get; set; }

        public event PropertyChangedEventHandler? PropertyChanged;
        protected void OnPropertyChanged([CallerMemberName] string? name = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
        }
    }
}
