namespace eSPJ.Models
{
    public enum JenisSampah
    {
        Organik,
        Anorganik,
        Residu
    }

    public class TimbanganItem
    {
        public string? FotoFileName { get; set; }
        public List<decimal> Berat { get; set; } = new();
        public List<string> LokasiAngkut { get; set; } = new();
        public List<JenisSampah> JenisSampah { get; set; } = new();
        public bool IsUploaded { get; set; }
        public DateTime? WaktuUpload { get; set; }
    }

    public class TpsData
    {
        public string NomorSpj { get; set; } = string.Empty;
        public string LokasiAngkutId { get; set; } = string.Empty;
        public string SpjDetailId { get; set; } = string.Empty;
        public string Name { get; set; } = string.Empty;
        public int Index { get; set; }
        public string Latitude { get; set; } = string.Empty;
        public string Longitude { get; set; } = string.Empty;
        public string AlamatJalan { get; set; } = string.Empty;
        public string WaktuKedatangan { get; set; } = string.Empty;
        public List<string> FotoKedatangan { get; set; } = new();
        public bool FotoKedatanganUploaded { get; set; }
        public List<TimbanganItem> Timbangan { get; set; } = new();
        public decimal TotalOrganik { get; set; }
        public decimal TotalAnorganik { get; set; }
        public decimal TotalResidu { get; set; }
        public decimal TotalTimbangan { get; set; }
        public List<string> FotoPetugas { get; set; } = new();
        public bool FotoPetugasUploaded { get; set; }
        public string NamaPetugas { get; set; } = string.Empty;
        public bool IsSubmit { get; set; }
        public DateTime UpdatedAt { get; set; } = DateTime.Now;
        public DateTime? SubmittedAt { get; set; }
    }

    public class DetailPenjemputanRequest
    {
        public string NomorSpj { get; set; } = string.Empty;
        public string LokasiAngkutId { get; set; } = string.Empty;
        public string SpjDetailId { get; set; } = string.Empty;
        public string TpsName { get; set; } = string.Empty;
        public string Latitude { get; set; } = string.Empty;
        public string Longitude { get; set; } = string.Empty;
        public string AlamatJalan { get; set; } = string.Empty;
        public string WaktuKedatangan { get; set; } = string.Empty;
        public decimal TotalTimbangan { get; set; }
        public decimal TotalOrganik { get; set; }
        public decimal TotalAnorganik { get; set; }
        public decimal TotalResidu { get; set; }
        public string NamaPetugas { get; set; } = string.Empty;
        public List<IFormFile>? FotoKedatangan { get; set; }
        public List<IFormFile>? FotoTimbangan { get; set; }
        public List<decimal>? BeratTimbangan { get; set; }
        public List<string>? JenisSampahList { get; set; }
        public List<IFormFile>? FotoPetugas { get; set; }
    }

    public class DetailPenjemputanResponse
    {
        public bool Success { get; set; }
        public string Message { get; set; } = string.Empty;
        public object? Data { get; set; }
    }

    public class OcrTimbanganRequest
    {
        public IFormFile? Foto { get; set; }
    }

    public class OcrTimbanganResponse
    {
        public bool Success { get; set; }
        public string? Weight { get; set; }
        public string? Raw { get; set; }
        public string Message { get; set; } = string.Empty;
    }

    public class RecordTimbanganItem
    {
        public decimal Berat { get; set; }
        public string JenisSampah { get; set; } = "Residu";
        public string FotoFileName { get; set; } = string.Empty;
        public bool Uploaded { get; set; }
        public string OcrInfo { get; set; } = string.Empty;
    }

    public class RecordSaveRequest
    {
        public string NomorSpj { get; set; } = string.Empty;
        public string NamaTps { get; set; } = string.Empty;
        public string LokasiAngkutId { get; set; } = string.Empty;
        public string SpjDetailId { get; set; } = string.Empty;
        public string Latitude { get; set; } = string.Empty;
        public string Longitude { get; set; } = string.Empty;
        public string AlamatJalan { get; set; } = string.Empty;
        public string WaktuKedatangan { get; set; } = string.Empty;
        public bool FotoKedatanganUploaded { get; set; }
        public List<string> FotoKedatanganFileNames { get; set; } = new();
        public List<RecordTimbanganItem> Timbangan { get; set; } = new();
        public decimal TotalOrganik { get; set; }
        public decimal TotalAnorganik { get; set; }
        public decimal TotalResidu { get; set; }
        public decimal TotalTimbangan { get; set; }
        public bool FotoPetugasUploaded { get; set; }
        public List<string> FotoPetugasFileNames { get; set; } = new();
        public string NamaPetugas { get; set; } = string.Empty;
        public bool IsSubmit { get; set; }
    }

    public class RecordSaveResponse
    {
        public bool Success { get; set; }
        public string Message { get; set; } = string.Empty;
    }
}
