using vendorApproverBackend.Enums; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; using vendorApproverBackend.Settings; namespace vendorApproverBackend.Entities { public class PrequalificationRequest { [Column("id")] public long Id { get; set; } [Column("status")] public RequestStatus Status { get; set; } = RequestStatus.DRAFT; [Column("submission_date")] public DateTime? SubmissionDate { get; set; } = DateTime.UtcNow; public long VendorId { get; set; } [JsonIgnore] public Vendor Vendor { get; set; } public DateTime? deadline { get; set; } public DateTime? ApprovalDate { get; set; } public DateTime? FirstApprovalDate { get; set; } [Column("assigned_to_user_id")] public long? AssignedToUserId { get; set; } [JsonIgnore] public virtual User AssignedTo { get; set; } [Column("assignment_date")] public DateTime? AssignmentDate { get; set; } [JsonIgnore] public virtual ICollection Inspectors { get; set; } = new List(); [JsonIgnore] public virtual AssessmentReport AssessmentReport { get; set; } [NotMapped] public long? AssessmentReportId => AssessmentReport?.Id; public string? Reason { get; set; } [JsonIgnore] public Product? Product { get; set; } [JsonIgnore] public Certification? Certification { get; set; } [JsonIgnore] public virtual ICollection Clarifications { get; set; } = new List(); [JsonIgnore] public virtual ICollection PqClarifications { get; set; } = new List(); public List AdminObservations { get; set; } = new(); // ====== STEP 1: General Information ====== public GeneralInformation? GeneralInformation { get; set; } // ====== STEP 2: Vendor Resources ====== public VendorResources? VendorResources { get; set; } // ====== STEP 3: Financial Standing ====== public FinancialStanding? FinancialStanding { get; set; } // ====== STEP 4: Experience & After Sales ====== public ExperienceAndAfterSales? ExperienceAndAfterSales { get; set; } // ====== STEP 5: Quality, HSE, Risk ====== public QualityHSERisk? QualityHSERisk { get; set; } // ====== STEP 6: Type Test ====== public TypeTest? TypeTest { get; set; } // ====== STEP 7: Equipment General Arrangement ====== public EquipmentGeneralArrangement? EquipmentGeneralArrangement { get; set; } // ====== STEP 8: Compliance ====== public Compliance? Compliance { get; set; } // ====== STEP 9: Declaration ====== public Declaration? Declaration { get; set; } [Column("timestmp")] public DateTime Timestamp { get; set; } = DateTime.UtcNow; [Column("payment_detail_id")] public long? PaymentDetailId { get; set; } [JsonIgnore] public PaymentDetail? PaymentDetail { get; set; } public VisitRequest? VisitRequest { get; set; } [NotMapped] public List InspectorsIds { get; set; } = new List(); [NotMapped] public List InspectorIds => Inspectors?.Select(u => u.Id).ToList() ?? new List(); [NotMapped] public List InspectorNames => Inspectors?.Select(u => u.Name).ToList() ?? new List(); [NotMapped] public string AssignedToUserName => AssignedTo != null ? AssignedTo.Name : string.Empty; } // ====== STEP 1: General Information ====== public class GeneralInformation { public string? StepOneApproverComment { get; set; } public string? FullName { get; set; } public string? ShortName { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? DateEstablished { get; set; } public string? OriginCountry { get; set; } public string? VendorGpsCoordinates { get; set; } public string? VendorWebsite { get; set; } public string? OfficeLocation { get; set; } public string? GccCountryName { get; set; } public string? OtherCountryName { get; set; } public string? OmanStreet { get; set; } public string? OmanPoBox { get; set; } public string? OmanTel { get; set; } public string? OmanFax { get; set; } public string? HqStreet { get; set; } public string? HqPoBox { get; set; } public string? HqTel { get; set; } public string? HqFax { get; set; } public string? HqEmail { get; set; } public string? FactoryStreet { get; set; } public string? FactoryPoBox { get; set; } public string? FactoryTel { get; set; } public string? FactoryFax { get; set; } public string? FactoryEmail { get; set; } public string? SalesStreet { get; set; } public string? SalesPoBox { get; set; } public string? SalesTel { get; set; } public string? SalesFax { get; set; } public string? SalesEmail { get; set; } public string? Category { get; set; } public string? Subcategory { get; set; } public string? ProductName { get; set; } public string? ProductCity { get; set; } public string? ProductCountry { get; set; } public string? ProductType { get; set; } public string? ProductDesc { get; set; } public List LocalOwners { get; set; } = new(); public bool? IsBranchInOman { get; set; } public List BoardOfDirectors { get; set; } = new(); public string? AgentNames { get; set; } public string? CommercialRegNumber { get; set; } public string? AgentContactPerson { get; set; } public string? AgentDesignation { get; set; } public string? RegisteredHeadOffice { get; set; } public string? GpsCoordinates { get; set; } public string? AgentTel { get; set; } public string? AgentFax { get; set; } public string? AgentEmail { get; set; } public string? AgentWebsite { get; set; } public List ContactPersons { get; set; } = new(); public List AuthorizedSignatories { get; set; } = new(); public string? OfficialAgencySubmitted { get; set; } public string? AuthorizedPersonsSubmitted { get; set; } public CertificatesAndLicenses? CertificatesAndLicenses { get; set; } public List AssociatedCompanies { get; set; } = new(); } public class LocalOwner { public string? Name { get; set; } public string? Nationality { get; set; } public string? OwnershipPercent { get; set; } } public class BoardOfDirector { public string? Name { get; set; } public string? Position { get; set; } public string? Nationality { get; set; } } public class ContactPerson { public string? Name { get; set; } public string? Designation { get; set; } public string? Tel { get; set; } public string? Email { get; set; } } public class AuthorizedSignatory { public string? Name { get; set; } public string? Designation { get; set; } public long? SpecimenSignatureId { get; set; } } public class CertificatesAndLicenses { public long? LocalSupportId { get; set; } public List SupportTeamCVsIds { get; set; } = new(); public TradeLicense? TradeLicense { get; set; } public ChamberMembership? ChamberMembership { get; set; } public List IndustrialLicenses { get; set; } = new(); } public class TradeLicense { public string? RegistrationNo { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? RegistrationDate { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? ExpiryDate { get; set; } public long? DocumentId { get; set; } } public class ChamberMembership { public string? RegistrationNo { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? RegistrationDate { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? ExpiryDate { get; set; } public long? DocumentId { get; set; } } public class IndustrialLicense { public string? IssuingAuthority { get; set; } public string? RegistrationNo { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? RegistrationDate { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? ExpiryDate { get; set; } public long? DocumentId { get; set; } } public class AssociatedCompany { public string? Name { get; set; } public string? Address { get; set; } public string? AssociationType { get; set; } public string? Notes { get; set; } } // ====== STEP 2: Vendor Resources ====== public class VendorResources { public string? StepTwoApproverComment { get; set; } public string? ProductionCapacity { get; set; } public string? TotalFactoryArea { get; set; } public string? TotalBuiltUpArea { get; set; } public string? DepartmentBuildings { get; set; } public long? OrgChartFileId { get; set; } public long? TechSupportChartFileId { get; set; } public List StaffDetails { get; set; } = new(); public List QualifiedStaff { get; set; } = new(); public bool? OrgChartManufacturer { get; set; } public bool? OrgChartCorporate { get; set; } public bool? OrgChartFactoryTechSupport { get; set; } public bool? OrgChartLocalTechSupport { get; set; } public long? OrgChartManufacturerFileId { get; set; } public long? OrgChartCorporateFileId { get; set; } public long? OrgChartFactoryTechSupportFileId { get; set; } public long? OrgChartLocalTechSupportFileId { get; set; } public List TechnicalItems { get; set; } = new(); public List Applications { get; set; } = new(); public string? CommunicationFacilities { get; set; } public string? PlanningProcess { get; set; } public string? PlanningMonitoring { get; set; } public string? ProductionPlanning { get; set; } public string? QualityControlPlanning { get; set; } public string? DesignProcess { get; set; } public string? DesignChangeControl { get; set; } public List SoftwareList { get; set; } = new(); public string? SupplierApprovalProcess { get; set; } public string? TransmissionToSuppliers { get; set; } public string? SupplierReevaluation { get; set; } public string? SupplierQCMeans { get; set; } public long? SupplierListFileId { get; set; } public string? ProductionProcessControl { get; set; } public long? ProductionSupportFileId { get; set; } public string? ProductionAuthority { get; set; } public string? IdentificationTraceability { get; set; } public string? MaintenanceOfEquipment { get; set; } public List ProductionQualifiedStaff { get; set; } = new(); public List QualityDocuments { get; set; } = new(); public string? StandardManagement { get; set; } public List InternationalStandards { get; set; } = new(); public string? QualityAuthority { get; set; } public List QualityQualifiedStaff { get; set; } = new(); public string? QualityTraceability { get; set; } public string? QcMethods { get; set; } public string? QcPlans { get; set; } public long? QcPlanFileId { get; set; } public string? QcProcedures { get; set; } public long? QcProceduresFileId { get; set; } public string? ReceiptMaterials { get; set; } public string? InventoryManagement { get; set; } public string? NonConformityControl { get; set; } public string? FailureStats { get; set; } public string? PackagingTransport { get; set; } public string? WasteManagement { get; set; } } public class StaffDetail { public int? Factory { get; set; } public int? OnSite { get; set; } public int? Own { get; set; } public int? Outsiders { get; set; } } public class QualifiedStaff { public string? Qualification { get; set; } public string? Designation { get; set; } public int? Number { get; set; } } public class TechnicalItem { public int? Count { get; set; } } public class Application { public string? Name { get; set; } } public class SoftwareItem { public string? Program { get; set; } public string? Version { get; set; } } public class ProductionQualifiedStaff { public string? Qualification { get; set; } public string? Position { get; set; } public int? Number { get; set; } } public class QualityDocument { public string? Title { get; set; } public string? Description { get; set; } public string? Edition { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? Date { get; set; } } public class InternationalStandard { public string? Standard { get; set; } public string? YesNo { get; set; } public string? Scope { get; set; } } public class QualityQualifiedStaff { public string? Qualification { get; set; } public string? Position { get; set; } public int? Number { get; set; } } // ====== STEP 3: Financial Standing ====== public class FinancialStanding { public string? StepThreeApproverComment { get; set; } public string? VendorFullName { get; set; } public List AuditReportsIds { get; set; } = new(); public string? AuditorName { get; set; } public string? AuditorAddress { get; set; } public string? EBITDA_2024 { get; set; } public string? EBITDA_2022 { get; set; } public string? EBITDA_2023 { get; set; } public string? NetProfitMargin_2024 { get; set; } public string? NetProfitMargin_2022 { get; set; } public string? NetProfitMargin_2023 { get; set; } public string? CurrentRatio_2024 { get; set; } public string? CurrentRatio_2022 { get; set; } public string? CurrentRatio_2023 { get; set; } public string? CashFlowRatio_2024 { get; set; } public string? CashFlowRatio_2022 { get; set; } public string? CashFlowRatio_2023 { get; set; } public string? DebtEquityRatio_2024 { get; set; } public string? DebtEquityRatio_2022 { get; set; } public string? DebtEquityRatio_2023 { get; set; } public List Bankers { get; set; } = new(); } public class Banker { public string? BankName { get; set; } public string? BankAddress { get; set; } public double? CreditAmount { get; set; } public string? CreditDetails { get; set; } } // ====== STEP 4: Experience & After Sales ====== public class ExperienceAndAfterSales { public string? StepFourApproverComment { get; set; } public List ClientReferences { get; set; } = new(); public string? ManufacturerProductInfo { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? ClientRefDate { get; set; } public bool? AfterSalesReport { get; set; } public bool? IssueTrackingSystem { get; set; } [JsonIgnore] [Column("warranty_certificate_file_id")] public long? WarrantyCertificateFileId { get; set; } public FileModel? WarrantyCertificateFile { get; set; } public long? WarrantyFileId { get; set; } public long? afterSalesReportFileId { get; set; } public long? issueTrackingSystemFileId { get; set; } } public class ClientReference { public string? Client { get; set; } public string? Country { get; set; } public string? Industry { get; set; } public string? Quantity { get; set; } public int? OrderYear { get; set;} public int? DeliveryYear { get; set; } public int? YearsInService { get; set; } public string? CertificateAttached { get; set; } public long? CertificateFileId { get; set; } } // ====== STEP 5: Quality, HSE, Risk ====== public class QualityHSERisk { public string? StepFiveApproverComment { get; set; } public List Certificates { get; set; } = new(); public bool? HasQualitySystem { get; set; } public bool? HasQaManual { get; set; } public bool? HasQaProcedures { get; set; } public bool? QaSystemMeetsStandard { get; set; } public string? QaSystemDetails { get; set; } public bool? QaSystemApprovedByAgency { get; set; } public string? ApprovedAgencyNames { get; set; } public bool? HasAuditSchedule { get; set; } public bool? HasHSEManual { get; set; } public bool? HseMeetsStandard { get; set; } public string? EngineeringStandards { get; set; } public string? RiskManagement { get; set; } public bool? HasTrainingFacility { get; set; } public string? TrainingDescription { get; set; } public List QaSummary { get; set; } = new(); public string? CertInProcessDetails { get; set; } public long? CertProcessLetterId { get; set; } } public class Certificate { public string? Standard { get; set; } public string? CertifiedBody { get; set; } } public class QaSummary { public string? Company { get; set; } public string? Standard { get; set; } } // ====== STEP 6: Type Test ====== public class TypeTest { public string? StepSixApproverComment { get; set; } public string? TestType { get; set; } public bool? ThirdPartyReports { get; set; } public bool? ThirdPartyCertificates { get; set; } public long? ThirdPartyReportsFileId { get; set; } public long? ThirdPartyCertificatesFileId { get; set; } public bool? FactoryOwnLab { get; set; } public bool? Lab17025Accredited { get; set; } public bool? FactoryTestApprovedProcedure { get; set; } public long? FactoryOwnLabFileId { get; set; } public long? Lab17025AccreditedFileId { get; set; } public long? FactoryTestApprovedProcedureFileId { get; set; } } // ====== STEP 7: Equipment General Arrangement ====== public class EquipmentGeneralArrangement { public string? StepSevenApproverComment { get; set; } public bool? GaDrawingEnclosed { get; set; } public bool? TypicalConnectionDrawing { get; set; } public bool? Product3DModel { get; set; } public long? GaFileId { get; set; } public long? ConnectionDrawingFileId { get; set; } public long? Product3DModelFileId { get; set; } } // ====== STEP 8: Compliance ====== public class Compliance { public string? StepEightApproverComment { get; set; } public bool? GtpSubmitted { get; set; } public long? GtpSubmittedFileId { get; set; } public bool ComplianceConfirmed { get; set; } public long? ComplianceConfirmedFileId { get; set; } public long? GtpFileId { get; set; } } // ====== STEP 9: Declaration ====== public class Declaration { public string? StepNineApproverComment { get; set; } public string? FullName { get; set; } public string? Designation { get; set; } public string? OnBehalfOf { get; set; } [JsonConverter(typeof(DateOnlyJsonConverter))] public DateTime? SignedDate { get; set; } public long? PowerOfAttorneyFileId { get; set; } } public class AdminObservation { public int? StepNumber { get; set; } public bool? EnableUpdate { get; set; } public string? Description { get; set; } } }