using Seenginx.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Seenginx.Services
{
	public class NginxService : INginxService
	{
		public async Task<IEnumerable<ConfigFile>> GetFilesAsync(NginxFilter filter = null)
		{
			return new List<ConfigFile>() {
				new ConfigFile
				{
					Folder = "/conf.d",
					Name = "matrix.conf",
					LastUpdated = DateTime.Now.AddDays(new Random(DateTime.Now.Millisecond).Next(-50,0)),
					OriginalBody = "something something",
					Owners = new string[]{ "root" },
					Permissions = "-drwe-rw-r"
				},
				new ConfigFile
				{
					Folder = "/conf.d",
					Name = "pleroma.conf",
					LastUpdated = DateTime.Now.AddDays(new Random(DateTime.Now.Millisecond).Next(-100,0)),
					OriginalBody = "something something 2",
					Owners = new string[]{ "root", "void" },
					Permissions = "-drwe-rw-r"
				},
				new ConfigFile
				{
					Folder = "/conf.d",
					Name = "ghost.conf",
					LastUpdated = DateTime.Now.AddDays(new Random(DateTime.Now.Millisecond).Next(-25,0)),
					OriginalBody = "something something 3",
					Owners = new string[]{ "root" },
					Permissions = "-drwe-rw-r",
					CanBeDeleted = false
				}
			};
		}

		public async Task<Result<bool>> TestNginxConfigurations()
		{
			var result = new Result<bool>();
			result.SetData(true);
			return result;
		}
	}
}
