﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HockeyApp.Models.Geo;
using HockeyApp.Common.Enums;
using HockeyApp.Models.Interfaces;
using HockeyApp.Models.Users;

namespace HockeyApp.Models.Persons
{
    /// <summary>
    /// Персона
    /// </summary>
    public abstract class Person : ILinkableEntity, IHistoryTrackableEntity
    {
        public long Id { get; set; }

        [Required]
        [StringLength(100)]
        public string FirstName { get; set; }

        [Required]
        [StringLength(100)]
        public string LastName { get; set; }

        [StringLength(100)]
        public string MiddleName { get; set; }

        [Required]
        [StringLength(250)]
        public string Name { get; set; }


        [Required]
        [StringLength(100)]
        public string LinkName { get; set; }

        /// <summary>
        /// Полное имя
        /// </summary>
        [MaxLength(500)]
        [Required]
        public string FullName { get; set; }

        /// <summary>
        /// Дата рождения
        /// </summary>
        [Column(TypeName = "date")]
        public DateTime? BirthDate { get; set; }

        /// <summary>
        /// Дата смерти
        /// </summary>
        [Column(TypeName = "date")]
        public DateTime? DeathDate { get; set; }

        /// <summary>
        /// Пол
        /// </summary>
        public Gender Gender { get; set; }

        /// <summary>
        /// Место рождения
        /// </summary>
        public long? CityId { get; set; }
        public virtual City City { get; set; }

        /// <summary>
        /// Фото
        /// </summary>
        public long? LogoId { get; set; }
        public virtual File Logo { get; set; }

        /// <summary>
        /// Описание
        /// </summary>
        public string About { get; set; }

        [Column(TypeName = "datetime")]
        public DateTime CreateDate { get; set; }

        [ForeignKey("Creator")]
        public long CreatorId { get; set; }
        public virtual User Creator { get; set; }

        [ForeignKey("Editor")]
        public long? EditorId { get; set; }
        public virtual User Editor { get; set; }
        public DateTime? EditDate { get; set; }

        //public virtual ICollection<Citizenship> Citizenships { get; set; }
    }
}