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

namespace Register_office;

public partial class ProcedureTypePrescription : IUnionId
{
	public object GetId() => ProcedurePrescriptionId;

	public int ProcedurePrescriptionId { get; set; }

    public int PrescriptionId { get; set; }

    public int ProcedureTypeId { get; set; }

    public DateTime ScheduledDatetime { get; set; }

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

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

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

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

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

	[Display(Name = "Запланированное время")]
	public DateTime ScheduledDatetime { get; set; }

	[Display(Name = "Процедура")]
	public string ProcedureName { get; set; } = null!;

	public ProcedureTypePrescriptionWrapper(ProcedureTypePrescription src)
	{
		ProcedurePrescriptionId = src.ProcedurePrescriptionId;
		PrescriptionId = src.PrescriptionId;
		ProcedureTypeId = src.ProcedureTypeId;
		ScheduledDatetime = src.ScheduledDatetime;
		ProcedureName = src.ProcedureType.Name;
	}

	internal static List<ProcedureTypePrescriptionWrapper> ToList(List<ProcedureTypePrescription> src)
	{
		List<ProcedureTypePrescriptionWrapper> res = [];

		foreach (ProcedureTypePrescription lst in src)
		{
			res.Add(new ProcedureTypePrescriptionWrapper(lst));
		}

		return res;
	}
}
