using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ResourcesManager.Models
{
    public class Resource
    {
        [Key]
        [HiddenInput(DisplayValue = true)]
        public int Id { get; set; }

        [Display(Name = "Leltári azonosító")]
        [Required]
        public string AssetTag { get; set; }

        [Display(Name = "Erőforrás Neve")]
        [StringLength(60)]
        [Required]
        public string Name { get; set; }

        [Display(Name = "Megosztható-e")]
        [Required]
        public bool IsShared { get; set; }

        [Display(Name = "Időlimit /óra/")]
        public int? TimeLimit { get; set; }

        [Display(Name = "Leírás")]
        [DataType(DataType.MultilineText)]
        public string Description { get; set; }

        [Display(Name = "Kép")]
        [DataType(DataType.ImageUrl)]
        public string ImagePath { get; set; }

        public virtual ICollection<Reservation> Reservation { get; set; }

        [Display(Name = "Felíratkozottak")]
        public virtual List<ApplicationUser> Users { get; set; }

        public Resource()
        {
            Reservation = new List<Reservation>();
            Users = new List<ApplicationUser>();
        }

        public override string ToString()
        {
            return "id: " + Id.ToString() + ", AssetTag: " + AssetTag.ToString() + ", Resource: " + Name.ToString()
                + ", IsShared: " + IsShared.ToString() + ", TimeLimit: " + TimeLimit.ToString()
                + ", Description: " + Description + ", ImagePath: " + ImagePath;
        }
    }
}
