using Register_office.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Register_office;

public partial class Patient
{
    public int PatientId { get; set; }

    public string PolicyNumber { get; set; } = null!;

    public virtual ICollection<HospitalAdmission> HospitalAdmissions { get; set; } = new List<HospitalAdmission>();

	public virtual Person PatientNavigation { get; set; } = null!;

    public virtual ICollection<Prescription> Prescriptions { get; set; } = new List<Prescription>();
}

internal class PatientWrapper
{
	[Display(Name = "hide")]
	public int PatientId { get; set; }

	[Display(Name = "Полис")]
	public string PolicyNumber { get; set; } = null!;

	[Display(Name = "Отчество")]
	public string LastName { get; set; } = null!;

	[Display(Name = "Имя")]
	public string FirstName { get; set; } = null!;

	[Display(Name = "Фамилия")]
	public string? MiddleName { get; set; }

	[Display(Name = "Дата рождения")]
	public DateOnly BirthDate { get; set; }

	[Display(Name = "Адрес")]
	public string Address { get; set; } = null!;

	[Display(Name = "Пол")]
	public string Gender { get; set; } = null!;

	public PatientWrapper(Patient src)
	{
		PatientId = src.PatientId;
		PolicyNumber = src.PolicyNumber;
		Person p = src.PatientNavigation;
		LastName = p.LastName;
		FirstName = p.FirstName;
		MiddleName = p.MiddleName;
		BirthDate = p.BirthDate;
		Address = p.Address;
		Gender = p.Gender;
	}

	internal static List<PatientWrapper> ToList(List<Patient> src)
	{
		List<PatientWrapper> res = [];

		foreach (Patient lst in src)
		{
			res.Add(new PatientWrapper(lst));
		}

		return res;
	}
}