using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WarehouseAppSHIPS.Models
{
    public class MtcRequest
    {
        [Key]
        public int Id { get; set; }
        public DateTime RequestDate { get; set; } = DateTime.Now;

        [Required, MaxLength(50)]
        public string NomorBatch { get; set; } = string.Empty;

        [ForeignKey("Requester")]
        public int RequesterId { get; set; }
        public virtual AppUser? Requester { get; set; }

        [Required, MaxLength(255)]
        public string ItemRequested { get; set; } = string.Empty;

        public int Qty { get; set; }

        [MaxLength(255)]
        public string? Purpose { get; set; }
        public string? DocumentPath { get; set; }

        public ProcurementStatus Status { get; set; } = ProcurementStatus.BelumDibeli;

        public bool? IsApproved { get; set; }
        public bool IsTaken { get; set; } = false;

        [ForeignKey("Material")]
        public int? MaterialId { get; set; }
        public virtual Material? Material { get; set; }

        // === TAMBAHAN BARU: Tracking Waktu Pengadaan MTC ===
        public DateTime? TanggalDiproses { get; set; } // Waktu saat diubah jadi "Sedang Dibeli"
        public DateTime? TanggalDatang { get; set; }   // Waktu saat diubah jadi "Barang Datang"

        // === TAMBAHAN BARU: Alasan Retur MTC ===
        [MaxLength(500)]
        public string? CatatanRetur { get; set; }
    }
}