using System.ComponentModel.DataAnnotations;
using Kreta.BusinessLogic.HelperClasses;
using Kreta.BusinessLogic.Interfaces;
using Kreta.Core.CustomAttributes;
using Kreta.Resources;

namespace Kreta.Web.Areas.Intezmeny.Models
{
    public class TeremGridModel : IKretaIdentity
    {
        public const string TeremExportAttributeId = nameof(TeremExportAttributeId);
        public const string HelyszinExportAttributeId = nameof(HelyszinExportAttributeId);

        public TeremGridModel() { }

        public TeremGridModel(TeremItemCo itemCo)
        {
            ID = itemCo.Id.ToString();
            Nev = itemCo.Nev;
            JellegNev = itemCo.JellegNev;
            MukodesihelyNev = itemCo.MukodesiHelyNev;
            Terulet = itemCo.Terulet.HasValue ? itemCo.Terulet.Value.ToString() : string.Empty;
            Kapacitas = itemCo.Kapacitas.HasValue ? itemCo.Kapacitas.Value.ToString() : string.Empty;
            AktivNev = itemCo.IsAktivNev;
            RogzitoId = itemCo.RogzitoId;
            SzervezetNeve = itemCo.SzervezetNeve;
            SzervezetAzonositoja = itemCo.SzervezetAzonositoja;
            Megjegyzes = itemCo.Megjegyzes;
            IsSzerkesztheto = itemCo.IsSzerkesztheto;
        }

        public string ID { get; set; }

        [Display(Name = nameof(IntezmenyResource.HelyisegNev), ResourceType = typeof(IntezmenyResource))]
        [SimpleExportColumn(TeremExportAttributeId, 00, nameof(IntezmenyResource.HelyisegNev), typeof(IntezmenyResource))]
        [SimpleExportColumn(HelyszinExportAttributeId, 00, nameof(IntezmenyResource.HelyisegNev), typeof(IntezmenyResource))]
        public string Nev { get; set; }

        [Display(Name = nameof(IntezmenyResource.HelyisegJelleg), ResourceType = typeof(IntezmenyResource))]
        [SimpleExportColumn(TeremExportAttributeId, 01, nameof(IntezmenyResource.HelyisegJelleg), typeof(IntezmenyResource))]
        public string JellegNev { get; set; }

        [Display(Name = nameof(IntezmenyResource.MukodesiHely), ResourceType = typeof(IntezmenyResource))]
        [SimpleExportColumn(TeremExportAttributeId, 02, nameof(IntezmenyResource.MukodesiHely), typeof(IntezmenyResource))]
        public string MukodesihelyNev { get; set; }

        [Display(Name = nameof(IntezmenyResource.Alapterulet_nm), ResourceType = typeof(IntezmenyResource))]
        [SimpleExportColumn(TeremExportAttributeId, 03, nameof(IntezmenyResource.Alapterulet_nm), typeof(IntezmenyResource))]
        public string Terulet { get; set; }

        [Display(Name = nameof(IntezmenyResource.Befogadokepesseg), ResourceType = typeof(IntezmenyResource))]
        [SimpleExportColumn(TeremExportAttributeId, 04, nameof(IntezmenyResource.Befogadokepesseg), typeof(IntezmenyResource))]
        public string Kapacitas { get; set; }

        [Display(Name = nameof(IntezmenyResource.Aktiv), ResourceType = typeof(IntezmenyResource))]
        [SimpleExportColumn(TeremExportAttributeId, 05, nameof(IntezmenyResource.Aktiv), typeof(IntezmenyResource))]
        [SimpleExportColumn(HelyszinExportAttributeId, 03, nameof(IntezmenyResource.Aktiv), typeof(IntezmenyResource))]
        public string AktivNev { get; set; }

        public int? RogzitoId { get; set; }

        [Display(Name = nameof(TeremResource.SzervezetNeve), ResourceType = typeof(TeremResource))]
        [SimpleExportColumn(HelyszinExportAttributeId, 01, nameof(TeremResource.SzervezetNeve), typeof(TeremResource))]
        public string SzervezetNeve { get; set; }

        [Display(Name = nameof(TeremResource.SzervezetAzonosito), ResourceType = typeof(TeremResource))]
        [SimpleExportColumn(HelyszinExportAttributeId, 02, nameof(TeremResource.SzervezetAzonosito), typeof(TeremResource))]
        public string SzervezetAzonositoja { get; set; }

        [SimpleExportColumn(HelyszinExportAttributeId, 04, nameof(IntezmenyResource.Megjegyzes), typeof(IntezmenyResource))]
        public string Megjegyzes { get; set; }

        public bool IsSzerkesztheto { get; set; }
    }
}