using PCUT.Models;
using System.Threading.Tasks;
using Http.Core;
using Http.Core.Extensions;
using static Http.Core.Constants.HttpConstants;
using Windows.UI.Xaml;
using Http.Core.Contexts;

namespace PCUT.ViewModels
{
    internal class CutDialogViewModel : NotificationBase
    {
        public double Width { get; set; }
        public double Height { get; set; }

        private string _printCommand;
        public string PrintCommand
        {
            get => _printCommand;
            set
            {
                SetProperty(ref _printCommand, value);
            }
        }

        public int CommandDisplayMinHeight { get => UserContext.Instance.DebugFeaturesEnabled ? 100 : 0; }
        public Visibility CommandDisplay { get => UserContext.Instance.DebugFeaturesEnabled ? Visibility.Visible : Visibility.Collapsed; }

        public async Task CutFileAsync(string fileId)
        {
            using (var httpClient = HttpClientFactory.CreateClient(ClientNames.ApiClient))
            {
                try
                {
                    _ = await httpClient.GetAsync(Api.Cut.FormatRoute(fileId));
                }
                catch
                {
                }
            }
        }
    }
}
