using Microsoft.AspNetCore.Components;
using Seenginx.Models;
using Seenginx.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

namespace Seenginx.Pages
{
	public class NginxLogsBase : ComponentBase
	{
		[Inject]
		public INginxService NginxService { get; set; }

		public string InputSearch { get; set; }

		public List<ConfigFile> ConfigFiles { get; set; } = new List<ConfigFile>();

		protected override async Task OnInitializedAsync()
		{
			ConfigFiles.AddRange(await NginxService.GetFilesAsync());
			await base.OnInitializedAsync();
		}

		protected void Change(object value, string name)
		{
			var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;

			StateHasChanged();
		}

	}
}
