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

namespace Register_office.Model;

public partial class ExaminationTypePrescription : IUnionId
{
	public object GetId() => ExaminationPrescriptionId;

	public int ExaminationPrescriptionId { get; set; }

	public int PrescriptionId { get; set; }

	public int? ResultId { get; set; }

	public int ExaminationTypeId { get; set; }

	public virtual ExaminationType ExaminationType { get; set; } = null!;

	public virtual Prescription Prescription { get; set; } = null!;

	public virtual Result? Result { get; set; }
}

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

	[Display(Name = "hide")]
	public int PrescriptionId { get; set; }

	[Display(Name = "hide")]
	public int? ResultId { get; set; }

	[Display(Name = "hide")]
	public int ExaminationTypeId { get; set; }

	[Display(Name = "Результат")]
	public string Result { get; set; } = null!;

	[Display(Name = "Обследование")]
	public string ExaminationName { get; set; } = null!;

	public ExaminationTypePrescriptionWrapper(ExaminationTypePrescription src)
	{
		ExaminationPrescriptionId = src.ExaminationPrescriptionId;
		PrescriptionId = src.PrescriptionId;
		ResultId = src.ResultId;
		ExaminationTypeId = src.ExaminationTypeId;
		if (src.Result != null)
			Result = new ResultWrapper(src.Result).Result;
		ExaminationName = src.ExaminationType.Name;
	}

	internal static List<ExaminationTypePrescriptionWrapper> ToList(List<ExaminationTypePrescription> src)
	{
		List<ExaminationTypePrescriptionWrapper> res = [];

		foreach (ExaminationTypePrescription lst in src)
		{
			res.Add(new ExaminationTypePrescriptionWrapper(lst));
		}

		return res;
	}
}
