using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EgtBEAMWALL.Core.ConstBeam;

namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
    // <Auto-Generated>
    // This is here so CodeMaid doesn't reorganize this document
    // </Auto-Generated>
    /// <summary>
    /// Tabella dei PROJ caricati dal BTL
    /// </summary>
    [Table("ProjList")]
    public class ProjModel
    {
        #region Public Properties

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

        [Column("BTLFileName")]
        public string BTLFileName { get; set; } = "";

        /// <summary>
        /// Data Creazione
        /// </summary>
        [Column("DtCreated")]
        [Index]
        public DateTime DtCreated { get; set; }

        /// <summary>
        /// Data Esportazione
        /// </summary>
        [Column("DtExported")]
        [Index]
        public DateTime DtExported { get; set; }

        /// <summary>
        /// Stato NEW = creato ma NON salvato
        /// </summary>
        [Index]
        [Column("IsNew")]
        public bool IsNew { get; set; } = true;

        /// <summary>
        /// ListName del BTL
        /// </summary>
        [Column("ListName")]
        public string ListName { get; set; } = "";

        /// <summary>
        /// Stato locked (quando aperto da un dispositivo in rete)
        /// </summary>
        [Column("Lock")]
        public bool Locked { get; set; } = false;

        [Column("ProdDbId")]
        public int? ProdDbId { get; set; }

        /// <summary>
        /// ID da modello ext
        /// </summary>
        [Column("Id")]
        [Index]
        public int ProjId { get; set; }

        /// <summary>
        /// Tipologia del progetto (Travi, Pareti, ...)
        /// </summary>
        public BWType PType { get; set; } = BWType.NULL;

        /// <summary>
        /// Macchina
        /// </summary>
        [Column("Machine")]
        public string Machine { get; set; } = "";

        /// <summary>
        /// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
        /// </summary>
        [Column("LockedBy")]
        public string LockedBy { get; set; } = "";

        /// <summary>
        /// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
        /// dispositivo in rete
        /// </summary>
        [Column("LockDate")]
        public DateTime LockDate { get; set; } = DateTime.MinValue;

        /// <summary>
        /// Record attivo (se false == cancellazione logica)
        /// </summary>
        [Index]
        [Column("IsActive")]
        public bool IsActive { get; set; } = true;
        /// <summary>
        /// Descrizione progetto (copiata da BTLFileName inizialmente)
        /// </summary>
        [Column("ProjDescription")]
        public string ProjDescription { get; set; } = "";

        /// <summary>
        /// Stato Archiviato = NON visualizzabile normalmente, già prodotto
        /// </summary>
        [Index]
        [Column("IsArchived")]
        public bool IsArchived { get; set; } = false;

        [ForeignKey("ProdDbId")]
        public virtual ProdModel Prod { get; set; }

        #endregion Public Properties
    }
}