using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
    /// <summary>
    /// Tabella dello stato attività WORK (PROD/SUPERVISORE)
    /// </summary>
    [Table("StatusMap")]
    public class StatusMapModel
    {
        #region Public Properties

        /// <summary>
        /// Data evento
        /// </summary>
        [Column("DtEvent")]
        public DateTime DtEvent { get; set; } = DateTime.Now;

        /// <summary>
        /// Indice di revisione informativa (per recupero rapido modifiche)
        /// </summary>
        [Column("Index")]
        public int Index { get; set; } = 0;

        /// <summary>
        /// Id dell'item (diventa chaive secondo il tipo)
        /// </summary>
        [Column("Id")]
        public int ItemId { get; set; } = 0;

        /// <summary>
        /// Tipo oggetto registrato
        /// </summary>
        [Column("ItemType")]
        public Core.StatusMapItemType ItemType { get; set; } = Core.StatusMapItemType.ND;

        /// <summary>
        /// Operazione tracciata
        /// </summary>
        [Column("Operation")]
        public Core.StatusMapOpType Operation { get; set; } = Core.StatusMapOpType.ND;

        /// <summary>
        /// Sessione (es supervisore)
        /// </summary>
        [Column("Session")]
        public string Session { get; set; } = "";

        [Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int StatusId { get; set; }

        /// <summary>
        /// Valore (free) associato all'evento
        /// </summary>
        [Column("Val")]
        public string Val { get; set; } = "";

        #endregion Public Properties

        #region Public Methods

        public override bool Equals(object obj)
        {
            if (!(obj is StatusMapModel item))
                return false;

            if (Index != item.Index)
                return false;
            if (DtEvent != item.DtEvent)
                return false;
            if (Session != item.Session)
                return false;
            if (ItemType != item.ItemType)
                return false;
            if (ItemId != item.ItemId)
                return false;
            if (Operation != item.Operation)
                return false;
            if (Val != item.Val)
                return false;

            return true;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        #endregion Public Methods
    }
}