namespace ComplianceDAL.DTO.GSTEWayBill; // Faithful port of GB4's Unisoft.AdminDAL.DTO.EWayBill types (EwayBillOffLineDTO/EwayBillList/ // EwayBillItemList/EwayBillListOnlineSubmitDTO). Field names/casing match GB4 exactly — these are // the literal JSON contract the government e-way portal (and the offline JSON export) expects. // Independent of ComplianceDAL.DTO.CanonicalInvoice — E-Invoice's canonical builder is untouched. public class EwayBillOffLineDTO { public string version { get; set; } = "1.0.0421"; public List billLists { get; set; } = []; } public class EwayBillList { public string userGstin { get; set; } = string.Empty; public string supplyType { get; set; } = string.Empty; public int subSupplyType { get; set; } public string subSupplyDesc { get; set; } = string.Empty; public string docType { get; set; } = string.Empty; public string docNo { get; set; } = string.Empty; public string docDate { get; set; } = string.Empty; public int transType { get; set; } public string fromGstin { get; set; } = string.Empty; public string fromTrdName { get; set; } = string.Empty; public string fromAddr1 { get; set; } = string.Empty; public string fromAddr2 { get; set; } = string.Empty; public string fromPlace { get; set; } = string.Empty; public int fromPincode { get; set; } public string fromStateCode { get; set; } = string.Empty; public string actualFromStateCode { get; set; } = string.Empty; public string toGstin { get; set; } = string.Empty; public string toTrdName { get; set; } = string.Empty; public string toAddr1 { get; set; } = string.Empty; public string toAddr2 { get; set; } = string.Empty; public string toPlace { get; set; } = string.Empty; public int toPincode { get; set; } public string toStateCode { get; set; } = string.Empty; public string actualToStateCode { get; set; } = string.Empty; public decimal totalValue { get; set; } public decimal cgstValue { get; set; } public decimal sgstValue { get; set; } public decimal igstValue { get; set; } public decimal cessValue { get; set; } public decimal TotNonAdvolVal { get; set; } public decimal OthValue { get; set; } public decimal totInvValue { get; set; } public int transMode { get; set; } public int transDistance { get; set; } public string transporterName { get; set; } = string.Empty; public string transporterId { get; set; } = string.Empty; public string transDocNo { get; set; } = string.Empty; public string transDocDate { get; set; } = string.Empty; public string vehicleNo { get; set; } = string.Empty; public string vehicleType { get; set; } = string.Empty; public int mainHsnCode { get; set; } public List itemList { get; set; } = []; } public class EwayBillItemList { public int itemNo { get; set; } public string productName { get; set; } = string.Empty; public string productDesc { get; set; } = string.Empty; public int hsnCode { get; set; } public decimal quantity { get; set; } public string qtyUnit { get; set; } = string.Empty; public decimal taxableAmount { get; set; } public decimal sgstRate { get; set; } public decimal cgstRate { get; set; } public decimal igstRate { get; set; } public decimal cessRate { get; set; } public decimal cessNonAdvol { get; set; } } // Shape actually sent to the government portal for the Upload (SubmissionMode "API") path — same // fields as EwayBillList but renames actualFromStateCode/actualToStateCode to actFromStateCode/ // actToStateCode and adds the fixed transactionType=4, matching GB4's EwayBillListOnlineSubmitDTO. public class EwayBillOnlineSubmitDTO { public string userGstin { get; set; } = string.Empty; public string supplyType { get; set; } = string.Empty; public int subSupplyType { get; set; } public string subSupplyDesc { get; set; } = string.Empty; public string docType { get; set; } = string.Empty; public string docNo { get; set; } = string.Empty; public string docDate { get; set; } = string.Empty; public int transType { get; set; } public string fromGstin { get; set; } = string.Empty; public string fromTrdName { get; set; } = string.Empty; public string fromAddr1 { get; set; } = string.Empty; public string fromAddr2 { get; set; } = string.Empty; public string fromPlace { get; set; } = string.Empty; public int fromPincode { get; set; } public string fromStateCode { get; set; } = string.Empty; public string actFromStateCode { get; set; } = string.Empty; public string toGstin { get; set; } = string.Empty; public string toTrdName { get; set; } = string.Empty; public string toAddr1 { get; set; } = string.Empty; public string toAddr2 { get; set; } = string.Empty; public string toPlace { get; set; } = string.Empty; public int toPincode { get; set; } public string toStateCode { get; set; } = string.Empty; public string actToStateCode { get; set; } = string.Empty; public decimal totalValue { get; set; } public decimal cgstValue { get; set; } public decimal sgstValue { get; set; } public decimal igstValue { get; set; } public decimal cessValue { get; set; } public decimal TotNonAdvolVal { get; set; } public decimal OthValue { get; set; } public decimal totInvValue { get; set; } public int transMode { get; set; } public int transDistance { get; set; } public string transporterName { get; set; } = string.Empty; public string transporterId { get; set; } = string.Empty; public string transDocNo { get; set; } = string.Empty; public string transDocDate { get; set; } = string.Empty; public string vehicleNo { get; set; } = string.Empty; public string vehicleType { get; set; } = string.Empty; public int mainHsnCode { get; set; } public int transactionType { get; set; } = 4; public List itemList { get; set; } = []; } // Matches GB4's EWayFromIRNDTO — the payload sent to GenerateEWayFromIRN, a different GSP endpoint // (and shape) from the regular GenerateEwayBill call used by GenerateEWayBillAsync. public class EWayFromIRNDTO { public string Irn { get; set; } = string.Empty; public int Distance { get; set; } public string TransMode { get; set; } = string.Empty; public string? TransId { get; set; } public string? TransName { get; set; } public string? TransDocDt { get; set; } public string? TransDocNo { get; set; } public string VehNo { get; set; } = string.Empty; public string VehType { get; set; } = "R"; } // Matches GB4's EwayFromIRNOutPutDTO — GenerateEWayFromIRN's response shape (status_cd/response_data/ // infodtls), different from EwayOutputResponseDTO's (status/data/alert) used by the regular // GenerateEwayBill/CancelEwayBill endpoints, so it needs its own DTO and parser. public class EwayFromIRNOutPutDTO { public int status_cd { get; set; } public ResponseDataEwayFromIRNDTO? response_data { get; set; } public List? infodtls { get; set; } } public class ResponseDataEwayFromIRNDTO { public long EwbNo { get; set; } public string EwbDt { get; set; } = string.Empty; public string EwbValidTill { get; set; } = string.Empty; } public class InfoDtlsEwayFromIRNDTO { public string InfCd { get; set; } = string.Empty; public string Desc { get; set; } = string.Empty; } // Matches GB4's EwayOutputResponseDTO — the GSP's e-way generation response shape. public class EwayOutputResponseDTO { public int status { get; set; } public List Error { get; set; } = []; public EWaySucessResponseDTO? data { get; set; } } public class EWayAPIError { public string ErrorCode { get; set; } = string.Empty; public string ErrorMessage { get; set; } = string.Empty; } public class EWaySucessResponseDTO { public string ewayBillNo { get; set; } = string.Empty; public string ewayBillDate { get; set; } = string.Empty; public string validUpto { get; set; } = string.Empty; public string? alert { get; set; } }