using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant.DbModels
{
//
// This is here so CodeMaid doesn't reorganize this document
//
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
[Table("RawItemList")]
public partial class RawItemModel
{
///
/// Primary Key AUTO
///
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RawItemId { get; set; }
///
/// Ext ref for Material
///
public int MatId { get; set; } = 0;
///
/// Qty available on wharehouse
///
public int QtyAvail { get; set; } = 0;
///
/// Bool for logical delete (cloud and on PC...)
///
public bool IsDeleted { get; set; } = false;
///
/// Check if is a Remnant
///
public bool IsRemn { get; set; } = true;
///
/// Location
///
public string Location { get; set; } = "";
///
/// Item's Lenght
///
public decimal LMm { get; set; } = 0;
///
/// Item's Width
///
public decimal WMm { get; set; } = 0;
///
/// Item's Height (Thikness/Spessore) in mm
///
public decimal HMm { get; set; } = 0;
///
/// Note (optional)
///
public string Note { get; set; } = "";
[NotMapped]
public string ItemDtmx
{
get
{
string answ = $"MT99999999W{WMm * 10:000000}H{HMm * 10:000000}L{LMm * 10:000000}";
if (MaterialNav != null)
{
answ = $"MT{MaterialNav.MatId:00000000}W{WMm * 10:000000}H{HMm * 10:000000}L{LMm * 10:000000}";
}
return answ;
}
}
///
/// Navigation property to Material
///
[ForeignKey("MatId")]
public virtual MaterialModel MaterialNav { get; set; } = null!;
}
}