using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using PSTW_CentralSystem.Models;

namespace PSTW_CentralSystem.Areas.Inventory.Models
{
    public class ItemModel
    {
        [Key]
        public int ItemID { get; set; }
        public string UniqueID { get; set; } = string.Empty;
        public required int CompanyId { get; set; }
        public required int DepartmentId { get; set; }
        public required int ProductId { get; set; }
        public required string? SerialNumber { get; set; }
        public required string? TeamType { get; set; }
        public required int Quantity { get; set; }
        public required string Supplier { get; set; }
        public required DateTime PurchaseDate { get; set; }
        public required string PONo { get; set; }
        public required string Currency { get; set; }
        public required float DefaultPrice { get; set; }
        public required float CurrencyRate { get; set; }
        public required float ConvertPrice { get; set; }
        public string? DONo { get; set; }
        public DateTime? DODate { get; set; }
        public required int Warranty { get; set; }
        public required DateTime EndWDate { get; set; }
        public string? InvoiceNo { get; set; }
        public DateTime? InvoiceDate { get; set; }
        [Comment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;")]
        public int ItemStatus { get; set; } = 1;
        public int? MovementId { get; set; }
        public string PartNumber { get; set; } = string.Empty;
        public int CreatedByUserId { get; set; }
        [ForeignKey("CreatedByUserId")]
        public virtual UserModel? CreatedBy { get; set; }
        [ForeignKey("CompanyId")]
        public virtual CompanyModel? Company { get; set; }
        [ForeignKey("DepartmentId")]
        public virtual DepartmentModel? Department { get; set; }
        [ForeignKey("ProductId")]
        public virtual ProductModel? Product { get; set; }
        [ForeignKey("MovementId")]
        public virtual ItemMovementModel? Movement { get; set; }
        public required DateTime? CreatedDate { get; set; }
        public required DateTime? ModifiedDate { get; set; }

    }

    public class ItemQuantityUpdateModel
    {
        public int ItemId { get; set; }
        public int Quantity { get; set; }
        public int MovementId { get; set; }

    }
}
