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

namespace Register_office.Model;

public partial class ReferenceValue : IUnionId
{
	public object GetId() => ReferenceValueId;

    public int ReferenceValueId { get; set; }

    public int ExaminationTypeId { get; set; }

    public int? AgeMin { get; set; }

    public int? AgeMax { get; set; }

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

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

    public virtual ReferenceNumericValue? ReferenceNumericValue { get; set; }

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

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

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

	[Display(Name = "Мин. возраст")]
	public int? AgeMin { get; set; }

	[Display(Name = "Макс. возраст")]
	public int? AgeMax { get; set; }

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

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

	public ReferenceValueWrapper(ReferenceValue src)
	{
		ReferenceValueId = src.ReferenceValueId;
		ExaminationTypeId = src.ExaminationTypeId;
		AgeMin = src.AgeMin;
		AgeMax = src.AgeMax;
		ExaminationName = src.ExaminationType.Name;
		Gender = src.Gender;
	}

	internal static List<ReferenceValueWrapper> ToList(List<ReferenceValue> src)
	{
		List<ReferenceValueWrapper> res = [];

		foreach (ReferenceValue lst in src)
		{
			res.Add(new ReferenceValueWrapper(lst));
		}

		return res;
	}
}
