using System;
using System.Collections.ObjectModel;
using ArcaneLibs;

namespace ModerationClient.Services;

public class StatusBarService : NotifyPropertyChanged {
    private string _statusText = "Ready";
    private bool _isBusy;

    public string StatusText {
        get => _statusText + " " + DateTime.Now.ToString("u")[..^1];
        set => SetField(ref _statusText, value);
    }

    public bool IsBusy {
        get => _isBusy;
        set => SetField(ref _isBusy, value);
    }
    
    public ObservableCollection<Progress> ProgressBars { get; } = new();
    
    
    public class Progress : NotifyPropertyChanged {
        public Progress(int total) {
            Total = total;
        }

        public int Total { get; }
        public int Current { get; private set; }

        public void Increment() {
            Current++;
            OnPropertyChanged(nameof(Current));
        }
    }
}