using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Npgsql;
using NpgsqlTypes;
using Register_office.Model;
using System.Collections.Generic;

namespace Register_office.ViewModel
{
	internal class OnlyMenuViewModel
	{
		private readonly GeneralViewModel _general;

		internal GeneralViewModel General => _general;

		public OnlyMenuViewModel()
		{
			_general = GeneralViewModel.Instance;
		}

		internal List<T> GetReport<T>()
		{
			List<T> report = [];
			switch (typeof(T).Name)
			{
				case "Analysis":
					List<Analysis> temp = General.Context.Database
					.SqlQueryRaw<Analysis>("SELECT * FROM get_results()")
					.ToList();
					report = temp as List<T> ?? [];
				break;
			}

			return report;
		}
	}
}
