using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwCoreLib.Lux.Data.DbModel
{
//
// This is here so CodeMaid doesn't reorganize this document
//
[Table("OfferRowList")]
public class OfferRowModel
{
///
/// ID del record
///
[Key]
public int OfferRowID { get; set; }
///
/// Riferimento offerta
///
public int OfferID { get; set; }
///
/// Riga Offerta (per ordinamento)
///
public int RowNum { get; set; } = 0;
///
/// Campo salvato dell'Environment
///
public string Environment { get; set; } = "WINDOW";
///
/// Campo salvato dell'UID da codice DataMatrix calcolato
///
public string OfferRowUID { get; set; } = "OFF00001230AZ";
///
/// Codice calcolato offerta ANNO.ID_RIGA_OFFERTA (0...Z come Dtx)
///
[NotMapped]
public string OfferRowDtx
{
get => $"OFF{Inserted.Year:yy}{OfferRowID:000000000}";
}
///
/// ID dell'articolo di vendita offerto
///
public int SellingItemID { get; set; }
///
/// Costo (standard / senza listini)
///
public double Cost { get; set; } = 0;
///
/// Margine percentuale standard
///
public double Qty { get; set; } = 1;
[NotMapped]
public double TotalCost
{
get => Qty * Cost;
}
///
/// Valore serializzato della composizione articolo (in formato JWD x finestra)
///
public string SerStruct { get; set; } = "";
///
/// Json contenente la serializzazione delle fasi previste per la stima dei tempi e costi in formato SerializedPhasePreview; potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali
///
public string ItemSPP { get; set; } = "";
///
/// BOM serializzata per la produzione dell'item
///
public string ItemBOM { get; set; } = "";
///
/// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti)
///
public bool BomOk { get; set; } = false;
///
/// Validazione livello item per Costo e range dimensione
///
public bool ItemOk { get; set; } = false;
///
/// Note libere
///
public string Note { get; set; } = "";
#if false
///
/// Stack degli ultimi item serializzati per Uno/Redo actions
///
[NotMapped]
public List UndoRedoSerStruct { get; set; } = new List();
#endif
///
/// DataOra inserimento
///
public DateTime Inserted { get; set; } = DateTime.Now;
///
/// DataOra ultima modifica
///
public DateTime Modified { get; set; } = DateTime.Now;
///
/// Navigazione Offer
///
[ForeignKey("OfferID")]
public virtual OfferModel OfferNav { get; set; } = null!;
///
/// Navigazione Item
///
[ForeignKey("SellingItemID")]
public virtual SellingItemModel SellingItemNav { get; set; } = null!;
}
}